Skip to content

Commit

Permalink
Merge pull request #221 from arthurmensch/ini_error
Browse files Browse the repository at this point in the history
Better ini error message when ini file is not in the run folder
  • Loading branch information
dohmatob committed May 27, 2016
2 parents 13e6941 + 2df3c94 commit 13f8c67
Showing 1 changed file with 10 additions and 5 deletions.
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

0 comments on commit 13f8c67

Please sign in to comment.