Skip to content

Commit 3e8e376

Browse files
committed
FIX: Drop deprecated message argument to FileNotFoundError
1 parent 154ea61 commit 3e8e376

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

nipype/interfaces/base/core.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,9 @@ def aggregate_outputs(self, runtime=None, needed_outputs=None):
476476
setattr(outputs, key, val)
477477
except TraitError as error:
478478
if 'an existing' in getattr(error, 'info', 'default'):
479-
msg = "No such file or directory for output '%s' of a %s interface" % \
480-
(key, self.__class__.__name__)
481-
raise FileNotFoundError(val, message=msg)
479+
msg = "No such file or directory '%s' for output '%s' of a %s interface" % \
480+
(val, key, self.__class__.__name__)
481+
raise FileNotFoundError(msg)
482482
raise error
483483
return outputs
484484

nipype/utils/filemanip.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@
4040

4141
PY3 = sys.version_info[0] >= 3
4242

43-
44-
class FileNotFoundError(OSError): # noqa
45-
"""Defines the exception for Python 2."""
46-
47-
def __init__(self, path):
48-
"""Initialize the exception."""
49-
super(FileNotFoundError, self).__init__(
50-
2, 'No such file or directory', '%s' % path)
43+
try:
44+
from builtins import FileNotFoundError
45+
except ImportError: # PY27
46+
class FileNotFoundError(OSError): # noqa
47+
"""Defines the exception for Python 2."""
48+
49+
def __init__(self, path):
50+
"""Initialize the exception."""
51+
super(FileNotFoundError, self).__init__(
52+
2, 'No such file or directory', '%s' % path)
5153

5254

5355
USING_PATHLIB2 = False

0 commit comments

Comments
 (0)