Skip to content

Commit

Permalink
FIX: make if-statement for extra-informative message in evaluate_conn…
Browse files Browse the repository at this point in the history
…ect_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.
  • Loading branch information
scott-huberty committed Jun 17, 2024
1 parent 4d1352a commit 24c42a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nipype/pipeline/engine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
(
Expand Down

0 comments on commit 24c42a8

Please sign in to comment.