diff --git a/pykat/finesse.py b/pykat/finesse.py index 2ca71c95830548a3b18e1b48ce497dda164e1a3d..08d1fae817a28bf1c5f73462b03311550b94560c 100644 --- a/pykat/finesse.py +++ b/pykat/finesse.py @@ -1541,16 +1541,18 @@ class kat(object): (stdout, stderr) = p.communicate() - r.stdout = stdout #.decode('unicode_escape') - r.stderr = stderr #.decode('unicode_escape') + r.stdout = stdout.decode('utf-8') + r.stderr = stderr.decode('utf-8') - for line in r.stdout[::-1]: - if line.lstrip().startswith('computation time:'): - try: - r.runtime = float(line.split(":")[1].replace("s","")) - except: - r.runtime = 0.0 + k = r.stdout.rfind('computation time:') + if k > 0: + try: + line = r.stdout[k:] + r.runtime = float(line.split(":")[1].replace("s","")) + except: + r.runtime = 0.0 + r.runDateTime = datetime.datetime.now() # If Finesse returned an error, just print that and exit!