Skip to content

Commit c4cf9c5

Browse files
committed
BUG: Process Directories as data sinks
In cases where a DataSink was specified as a directory with a trailing '/' (i.e. os.path.sep) the dst resulted in an empty string and triggered an error: File "/tmp/nipype/nipype/interfaces/io.py", line 243, in _get_dst if dst[0] == os.path.sep: IndexError: string index out of range DEBUGING OUTPUTS HACK: src='/tmp/small_EXP_CACHE/BAW_20120730/WF_subj001/TissueClassify/BABC/' HACK: path='/tmp/small_EXP_CACHE/BAW_20120730/WF_subj001/TissueClassify/BABC' HACK: fname='' HACK: dst=''
1 parent bb28c5e commit c4cf9c5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

nipype/interfaces/io.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ def __init__(self, infields=None, **kwargs):
221221
self.inputs.trait_set(trait_change_notify=False, **undefined_traits)
222222

223223
def _get_dst(self, src):
224+
## If path is directory with trailing os.path.sep,
225+
## then remove that for a more robust behavior
226+
src = src.rstrip(os.path.sep)
224227
path, fname = os.path.split(src)
225228
if self.inputs.parameterization:
226229
dst = path

0 commit comments

Comments
 (0)