You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apparently, some Exception classes may not have a .message attribute. This can be more problematic when catching base Exception and then trying to log/warn using a string incorporating the original Exception's .message attribute. Maybe using str(ex) is more compatible, or more specific exception classes?
"Could not get dependencies of %s. Error:\n%s", name, ex.message
)
returndeps
will cause a throw exception if an OSError is caught, since OSError does not have a .message attribute (at least in python 3.8.3)
Actual behavior
Python 3.8.3 (default, May 19 2020, 18:47:26)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = OSError('darn')
>>> a.message
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'OSError' object has no attribute 'message'
Expected behavior
>>> str(a)
'darn'
The text was updated successfully, but these errors were encountered:
Summary
Apparently, some
Exception
classes may not have a.message
attribute. This can be more problematic when catching baseException
and then trying to log/warn using a string incorporating the original Exception's.message
attribute. Maybe usingstr(ex)
is more compatible, or more specific exception classes?Example (from
master
):nipype/nipype/utils/filemanip.py
Lines 866 to 877 in b356ad1
will cause a throw exception if an
OSError
is caught, since OSError does not have a.message
attribute (at least in python 3.8.3)Actual behavior
Expected behavior
The text was updated successfully, but these errors were encountered: