From c32b54a47d0808321217522883df19ad18d5d292 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 2 Aug 2013 23:17:38 +0000 Subject: [PATCH] [ck2cti] Fix for reading files with no final 'END' keyword --- interfaces/python/ck2cti.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/interfaces/python/ck2cti.py b/interfaces/python/ck2cti.py index 79e334b4c..29955f119 100755 --- a/interfaces/python/ck2cti.py +++ b/interfaces/python/ck2cti.py @@ -1340,7 +1340,7 @@ class Parser(object): if contains(line, 'ELEMENTS'): index = get_index(tokens, 'ELEMENTS') tokens = tokens[index+1:] - while not contains(line, 'END'): + while line is not None and not contains(line, 'END'): # Grudging support for implicit end of section if contains(line, 'SPECIES'): self.warn('"ELEMENTS" section implicitly ended by start of ' @@ -1361,7 +1361,7 @@ class Parser(object): # List of species identifiers index = get_index(tokens, 'SPECIES') tokens = tokens[index+1:] - while not contains(line, 'END'): + while line is not None and not contains(line, 'END'): # Grudging support for implicit end of section if (contains(line, 'REACTIONS') or contains(line, 'TRAN') or contains(line, 'THERM')): @@ -1388,7 +1388,7 @@ class Parser(object): entryPosition = 0 entryLength = None entry = [] - while not get_index(line, 'END') == 0: + while line is not None and not get_index(line, 'END') == 0: # Grudging support for implicit end of section if (contains(line, 'REACTIONS') or contains(line, 'TRAN')): self.warn('"THERMO" section implicitly ended by start of ' @@ -1442,10 +1442,10 @@ class Parser(object): elif contains(line, 'THERM'): # List of thermodynamics (hopefully one per species!) line, comment = readline() - if not contains(line, 'END'): + if line is not None and not contains(line, 'END'): TintDefault = float(line.split()[1]) thermo = [] - while not contains(line, 'END'): + while line is not None and not contains(line, 'END'): # Grudging support for implicit end of section if contains(line, 'REACTIONS') or contains(line, 'TRAN'): self.warn('"THERMO" section implicitly ended by start of '