From 5f08b362aae40d1804f30ba1e25a786879c47970 Mon Sep 17 00:00:00 2001 From: "Bryan W. Weber" Date: Fri, 28 Jun 2019 22:22:38 -0400 Subject: [PATCH] [CTI/YAML] Check convert arguments in cti2yaml Check that one, and only one, of the filename/text arguments are specified. --- interfaces/cython/cantera/cti2yaml.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/interfaces/cython/cantera/cti2yaml.py b/interfaces/cython/cantera/cti2yaml.py index 4e0cf8416..64b8b58a4 100644 --- a/interfaces/cython/cantera/cti2yaml.py +++ b/interfaces/cython/cantera/cti2yaml.py @@ -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