Skip to content

Commit f63861e

Browse files
committed
make the default fom optional
1 parent a83076a commit f63861e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

capsul/process/runprocess.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,12 @@ def main():
347347
'commandline nor study configfile, taken as the same as '
348348
'input.')
349349
group1.add_option('--if', '--input-fom', dest='input_fom',
350-
default='morphologist-bids-1.0',
351350
help='input FOM (File Organization Model). Decides '
352351
'which files and directories layout for the input '
353352
'data. Generally "morphologist-bids-1.0" or '
354353
'"morphologist-auto-nonoverlap-1.0". Default: '
355354
'"morphologist-bids-1.0"')
356355
group1.add_option('--of', '--output-fom', dest='output_fom',
357-
default='morphologist-bids-1.0',
358356
help='input FOM (File Organization Model). Decides '
359357
'which files and directories layout for the output '
360358
'data. Generally "morphologist-bids-1.0" or '
@@ -470,6 +468,8 @@ def main():
470468
parser.disable_interspersed_args()
471469
(options, args) = parser.parse_args()
472470

471+
default_fom = 'morphologist-bids-1.0'
472+
473473
if options.opengl:
474474
qt_backend.set_headless(needs_opengl=True)
475475

@@ -542,8 +542,19 @@ def main():
542542
config = session.config('fom', 'global')
543543
if options.input_fom is not None:
544544
config.input_fom = options.input_fom
545+
else:
546+
try:
547+
config.input_fom = default_fom
548+
except KeyError:
549+
print('Warning: FOM', default_fom, 'could not be loaded.',
550+
file=sys.stderr)
545551
if options.output_fom is not None:
546552
config.output_fom = options.output_fom
553+
else:
554+
try:
555+
config.output_fom = default_fom
556+
except KeyError:
557+
pass
547558

548559
kwre = re.compile(r'([a-zA-Z_](\.?[a-zA-Z0-9_])*)\s*=\s*(.*)$')
549560

0 commit comments

Comments
 (0)