Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions nipype/interfaces/base/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ def aggregate_outputs(self, runtime=None, needed_outputs=None):
setattr(outputs, key, val)
except TraitError as error:
if 'an existing' in getattr(error, 'info', 'default'):
msg = "No such file or directory for output '%s' of a %s interface" % \
(key, self.__class__.__name__)
raise FileNotFoundError(val, message=msg)
msg = "No such file or directory '%s' for output '%s' of a %s interface" % \
(val, key, self.__class__.__name__)
raise FileNotFoundError(msg)
raise error
return outputs

Expand Down
18 changes: 10 additions & 8 deletions nipype/utils/filemanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@

PY3 = sys.version_info[0] >= 3


class FileNotFoundError(OSError): # noqa
"""Defines the exception for Python 2."""

def __init__(self, path):
"""Initialize the exception."""
super(FileNotFoundError, self).__init__(
2, 'No such file or directory', '%s' % path)
try:
from builtins import FileNotFoundError
except ImportError: # PY27
class FileNotFoundError(OSError): # noqa
"""Defines the exception for Python 2."""

def __init__(self, path):
"""Initialize the exception."""
super(FileNotFoundError, self).__init__(
2, 'No such file or directory', '%s' % path)


USING_PATHLIB2 = False
Expand Down