Skip to content

Commit 4f7b44e

Browse files
author
dmordom
committed
fixed treatment of filename when namesource is not a file
1 parent 99240e0 commit 4f7b44e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

nipype/interfaces/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,11 @@ def _filename_from_source(self, name):
14751475
source = getattr(self.inputs, name_source)
14761476
while isinstance(source, list):
14771477
source = source[0]
1478-
_, base, _ = split_filename(source)
1478+
#special treatment for files
1479+
if isinstance(source, str) and os.path.exists(source):
1480+
_, base, _ = split_filename(source)
1481+
else:
1482+
base = source
14791483
retval = name_template % base
14801484
_, _, ext = split_filename(retval)
14811485
if trait_spec.keep_extension and ext:

0 commit comments

Comments
 (0)