[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:
Bryan W. Weber 2019-06-28 22:22:38 -04:00
parent 27438751ce
commit 5f08b362aa
No known key found for this signature in database
GPG key ID: 3A93E209C87E1FE7

View file

@ -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