Commit 87c5cc3e by Alexandre Routier

Fix issue with create-subjects-visits iotools when creating a new folder

parent 216456dc
Pipeline #826 passed with stages
in 20 seconds
......@@ -9,20 +9,26 @@ class CmdParserSubjectsSessions(ce.CmdParser):
self._name = 'create-subjects-visits'
def define_description(self):
self._description = 'Create a TSV file containing a list of participants with their sessions.'
self._description = 'Create a TSV file containing participants with their sessions'
def define_options(self):
self._args.add_argument("bids_directory",
help='Path to the BIDS dataset directory.')
self._args.add_argument("out_directory",
help='Path to the output directory.') # noqa
self._args.add_argument("-on", '--output_name',
type=str, default='',
help='(Optional) Name of the output file.') # noqa
self._args.add_argument("out_tsv",
help='Output TSV file containing the participants with their sessions.') # noqa
def run_command(self, args):
import os
import errno
from clinica.iotools.utils import data_handling as dt
dt.create_subs_sess_list(args.bids_directory, args.out_directory, args.output_name)
output_directory = os.path.dirname(args.out_tsv)
if not os.path.exists(output_directory):
try:
os.makedirs(output_directory)
except OSError as exc: # Guard against race condition
if exc.errno != errno.EEXIST:
raise
dt.create_subs_sess_list(args.bids_directory, output_directory, os.path.basename(args.out_tsv))
class CmdParserMergeTsv(ce.CmdParser):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment