[ck2cti] Improve error messages associated with missing input files

Partial cherry-pick of trunk r2856.
This commit is contained in:
Ray Speth 2014-04-29 19:02:02 +00:00
parent 953fc46c27
commit e59ca5ff6b

View file

@ -1796,6 +1796,8 @@ duplicate transport data) to be ignored.
if permissive is not None: if permissive is not None:
self.warning_as_error = not permissive self.warning_as_error = not permissive
if not os.path.exists(inputFile):
raise IOError('Missing input file: {0!r}'.format(inputFile))
try: try:
# Read input mechanism files # Read input mechanism files
self.loadChemkinFile(inputFile) self.loadChemkinFile(inputFile)
@ -1805,6 +1807,8 @@ duplicate transport data) to be ignored.
raise raise
if thermoFile: if thermoFile:
if not os.path.exists(thermoFile):
raise IOError('Missing thermo file: {0!r}'.format(thermoFile))
try: try:
self.loadChemkinFile(thermoFile) self.loadChemkinFile(thermoFile)
except Exception: except Exception:
@ -1813,6 +1817,8 @@ duplicate transport data) to be ignored.
raise raise
if transportFile: if transportFile:
if not os.path.exists(transportFile):
raise IOError('Missing transport file: {0!r}'.format(transportFile))
lines = open(transportFile, 'rU').readlines() lines = open(transportFile, 'rU').readlines()
self.parseTransportData(lines) self.parseTransportData(lines)