Skip to content

Commit 0e3ea76

Browse files
anbai106effigies
authored andcommitted
Datagrabber bug with the flag raise_on_empty
1 parent 166e06c commit 0e3ea76

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nipype/interfaces/io.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,8 +1242,11 @@ def _list_outputs(self):
12421242
if self.inputs.sort_filelist:
12431243
outfiles = human_order_sorted(outfiles)
12441244
outputs[key].append(list_to_filename(outfiles))
1245-
if any([val is None for val in outputs[key]]):
1246-
outputs[key] = []
1245+
if self.inputs.raise_on_empty: # if the raise_on_empty is True by default, make sure no None in outputs
1246+
if any([val is None for val in outputs[key]]):
1247+
outputs[key] = []
1248+
else: # if the raise_on_empty is False remove the Nones in outputs
1249+
outputs[key] = [[] if x is None else x for x in outputs[key]]
12471250
if len(outputs[key]) == 0:
12481251
outputs[key] = None
12491252
elif len(outputs[key]) == 1:

0 commit comments

Comments
 (0)