Skip to content

Commit 8bffa93

Browse files
authored
Merge pull request #3655 from scott-huberty/evaluate_connect_fix
FIX: evaluate_connect_function should raise error on un-nested imports
2 parents 7139c7f + df241b2 commit 8bffa93

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

nipype/pipeline/engine/utils.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -689,15 +689,10 @@ 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"):
693-
e.args = (
694-
e.args[0],
695-
(
696-
"Due to engine constraints all imports have to be done "
697-
"inside each function definition"
698-
),
699-
)
700-
raise e
692+
raise NameError(
693+
f"{e}: Due to engine constraints all imports have to be done inside each "
694+
" function definition."
695+
)
701696
return output_value
702697

703698

0 commit comments

Comments
 (0)