Skip to content
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

Better ini error message when ini file is not in the run folder #221

Merged
merged 1 commit into from
May 27, 2016
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
15 changes: 10 additions & 5 deletions pypreprocess/nipype_preproc_spm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1519,12 +1519,17 @@ def do_subjects_preproc(subject_factory, session_ids=None, **preproc_params):
# load .ini ?
preproc_details = None
if isinstance(subject_factory, basestring):
with open(subject_factory, "r") as fd:
preproc_details = fd.read()
fd.close()
try:
with open(subject_factory, "r") as fd:
preproc_details = fd.read()
fd.close()
except IOError:
raise IOError('Could not load %s, please make sure to run your '
'script within the same folder'
' as the .ini file' % subject_factory)
subject_factory, _preproc_params = _generate_preproc_pipeline(
subject_factory, dataset_dir=preproc_params.get(
"dataset_dir", None))
subject_factory, dataset_dir=preproc_params.get(
"dataset_dir", None))
_preproc_params.update(preproc_params)
preproc_params = _preproc_params

Expand Down