Commit 7bc44516 authored by Andreas Freise's avatar Andreas Freise
Browse files

Merge branch 'master' of gitlab.aei.uni-hannover.de:finesse/pykat

parents 85a688f2 3c94b18d
......@@ -3,7 +3,7 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
__version__ = "1.0.11"
__version__ = "1.0.13"
# This flag is used to switch on the gui features in pkat at import time
USE_GUI = False
......
......@@ -924,7 +924,9 @@ class kat(object):
`^-....____: +. {1}\n""".format(pykat.__version__, pykat_web))
def loadKatFile(self, katfile, blocks=None):
commands=open(katfile).read()
with open(katfile) as f:
commands= f.read()
self.parseCommands(commands, blocks=blocks)
def parseKatCode(self, code, blocks=None):
......@@ -1444,11 +1446,10 @@ class kat(object):
Saves the current kat object to a Finesse input file
"""
try:
katScript = "".join(self.generateKatScript())
katfile = open(filename,'w')
katfile.writelines(katScript)
katfile.flush()
katfile.close()
with open(filename,'w') as katfile:
katScript = "".join(self.generateKatScript())
katfile.writelines(katScript)
katfile.flush()
except pkex.BasePyKatException as ex:
print (ex)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment