nipype
nipype copied to clipboard
FIX: evaluate_connect_function should raise error on un-nested imports
trafficstars
Summary
if I'm understanding evaluate_connect_function correctly, the intent of the if-clause is to catch errors that arise from calling libraries/modules/functions that were imported at the module level (as opposed to nesting the imports at the function level), and raises a more informative error for those cases.
I think https://github.com/nipreps/nibabies/pull/365 gives one example where the if-clause should catch such an error, but doesn't, because the error doesn't start with "global name". So I think it should be okay to make the if-clause more permissive, i.e. just check if the error message ends with "is not defined", then return the extra-informative error message to the user.
What do you think?