Skip to content

bug for datagrabber #1915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 16, 2018
Merged
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
11 changes: 9 additions & 2 deletions nipype/interfaces/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,10 @@ class DataGrabberInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
True,
usedefault=True,
desc='Generate exception if list is empty for a given field')
drop_blank_outputs = traits.Bool(
False, usedefault=True,
desc="Remove ``None`` entries from output lists"
)
sort_filelist = traits.Bool(
mandatory=True, desc='Sort the filelist that matches the template')
template = Str(
Expand Down Expand Up @@ -1242,8 +1246,11 @@ def _list_outputs(self):
if self.inputs.sort_filelist:
outfiles = human_order_sorted(outfiles)
outputs[key].append(list_to_filename(outfiles))
if any([val is None for val in outputs[key]]):
outputs[key] = []
if self.inputs.drop_blank_outputs:
outputs[key] = [x for x in outputs[key] if x is not None]
else:
if any([val is None for val in outputs[key]]):
outputs[key] = []
if len(outputs[key]) == 0:
outputs[key] = None
elif len(outputs[key]) == 1:
Expand Down