Skip to content

Commit 24c42a8

Browse files
committed
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. nipreps/nibabies#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.
1 parent 4d1352a commit 24c42a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nipype/pipeline/engine/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ def evaluate_connect_function(function_source, args, first_arg):
689689
try:
690690
output_value = func(first_arg, *list(args))
691691
except NameError as e:
692-
if e.args[0].startswith("global name") and e.args[0].endswith("is not defined"):
692+
if e.args[0].endswith("is not defined"):
693693
e.args = (
694694
e.args[0],
695695
(

0 commit comments

Comments
 (0)