From d04fd8cc39cb9982aafe7cac28b58174b5fd6a81 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 18 Feb 2019 16:25:30 -0500 Subject: [PATCH] [ck2cti] Show name of species with undefined elements in error message --- interfaces/cython/cantera/ck2cti.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/interfaces/cython/cantera/ck2cti.py b/interfaces/cython/cantera/ck2cti.py index 8d1182e01c..b6baf64418 100644 --- a/interfaces/cython/cantera/ck2cti.py +++ b/interfaces/cython/cantera/ck2cti.py @@ -1995,17 +1995,16 @@ def parseTransportData(self, lines, filename, line_offset): def getSpeciesString(self, speciesList, indent): speciesNameLength = 1 - elementsFromSpecies = set() + allElements = set(self.elements) for s in speciesList: if s.composition is None: raise InputParseError('No thermo data found for species: {0!r}'.format(s.label)) - elementsFromSpecies.update(s.composition) + missingElements = set(s.composition) - allElements + if missingElements: + raise InputParseError("Undefined elements in species '{}':" + " {}".format(s.label, ','.join(repr(e) for e in missingElements))) speciesNameLength = max(speciesNameLength, len(s.label)) - missingElements = elementsFromSpecies - set(self.elements) - if missingElements: - raise InputParseError('Undefined elements: ' + str(missingElements)) - speciesNames = [''] speciesPerLine = max(int((80-indent)/(speciesNameLength + 2)), 1)