From 469d0c67db95e0e01400c8a303913c203a710070 Mon Sep 17 00:00:00 2001 From: Scott Huberty Date: Sun, 16 Jun 2024 19:12:29 -0700 Subject: [PATCH] FIX: make if-statement for extra-informative message in evaluate_connect_function more permissive the if-statement in this function is very specific and ensures that the error message both starts with "global name" and ends with "is not defined" before raising the informative error about nested imports. https://github.com/nipreps/nibabies/pull/365 gives one example where this if-statement is too specific, and doesn't catch a NameError that does actually arise from a module-level import. --- nipype/pipeline/engine/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/pipeline/engine/utils.py b/nipype/pipeline/engine/utils.py index c5bc83c832..0f192ccedb 100644 --- a/nipype/pipeline/engine/utils.py +++ b/nipype/pipeline/engine/utils.py @@ -689,7 +689,7 @@ def evaluate_connect_function(function_source, args, first_arg): try: output_value = func(first_arg, *list(args)) except NameError as e: - if e.args[0].startswith("global name") and e.args[0].endswith("is not defined"): + if e.args[0].endswith("is not defined"): e.args = ( e.args[0], (