Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: evaluate_connect_function should raise error on un-nested imports #3655

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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(

Check warning on line 692 in nipype/pipeline/engine/utils.py

View check run for this annotation

Codecov / codecov/patch

nipype/pipeline/engine/utils.py#L692

Added line #L692 was not covered by tests
f"{e}: Due to engine constraints all imports have to be done inside each "
" function definition."
)
return output_value


Expand Down