From e59ca5ff6b0833859806f95a8ed375cf002eb99d Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 29 Apr 2014 19:02:02 +0000 Subject: [PATCH] [ck2cti] Improve error messages associated with missing input files Partial cherry-pick of trunk r2856. --- interfaces/python/ck2cti.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/interfaces/python/ck2cti.py b/interfaces/python/ck2cti.py index 9dd594bdb..a4b879e05 100755 --- a/interfaces/python/ck2cti.py +++ b/interfaces/python/ck2cti.py @@ -1796,6 +1796,8 @@ duplicate transport data) to be ignored. if permissive is not None: self.warning_as_error = not permissive + if not os.path.exists(inputFile): + raise IOError('Missing input file: {0!r}'.format(inputFile)) try: # Read input mechanism files self.loadChemkinFile(inputFile) @@ -1805,6 +1807,8 @@ duplicate transport data) to be ignored. raise if thermoFile: + if not os.path.exists(thermoFile): + raise IOError('Missing thermo file: {0!r}'.format(thermoFile)) try: self.loadChemkinFile(thermoFile) except Exception: @@ -1813,6 +1817,8 @@ duplicate transport data) to be ignored. raise if transportFile: + if not os.path.exists(transportFile): + raise IOError('Missing transport file: {0!r}'.format(transportFile)) lines = open(transportFile, 'rU').readlines() self.parseTransportData(lines)