Skip to content

Commit

Permalink
Merge pull request #3655 from scott-huberty/evaluate_connect_fix
Browse files Browse the repository at this point in the history
FIX: evaluate_connect_function should raise error on un-nested imports
  • Loading branch information
effigies authored Oct 31, 2024
2 parents 7139c7f + df241b2 commit 8bffa93
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions nipype/pipeline/engine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,15 +689,10 @@ 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"):
e.args = (
e.args[0],
(
"Due to engine constraints all imports have to be done "
"inside each function definition"
),
)
raise e
raise NameError(
f"{e}: Due to engine constraints all imports have to be done inside each "
" function definition."
)
return output_value


Expand Down

0 comments on commit 8bffa93

Please sign in to comment.