[CTI/YAML] Check convert arguments in cti2yaml
Check that one, and only one, of the filename/text arguments are specified.
This commit is contained in:
parent
27438751ce
commit
5f08b362aa
1 changed files with 5 additions and 1 deletions
|
|
@ -14,7 +14,6 @@ specified.
|
|||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import pathlib
|
||||
from collections import OrderedDict
|
||||
|
|
@ -1530,6 +1529,11 @@ def convert(filename=None, output_name=None, text=None):
|
|||
_reactions.clear()
|
||||
_reactions['reactions'] = []
|
||||
|
||||
if filename is None and text is None:
|
||||
raise ValueError("One of filename or text must be specified")
|
||||
elif (filename is not None and text is not None):
|
||||
raise ValueError("Only one of filename or text should be specified")
|
||||
|
||||
if filename is not None:
|
||||
filename = pathlib.Path(filename).expanduser()
|
||||
base = filename.name
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue