From db5002567382d352dfb13bacc716dd07b0d5aa23 Mon Sep 17 00:00:00 2001 From: Andreas Freise <adf@star.bham.ac.uk> Date: Thu, 28 Nov 2013 12:23:32 +0000 Subject: [PATCH] fixing a number of subtle errors which kept this from running on my machine, such as temporary file without name, subprocess call with encapsualted flags. --- pykat/finesse.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pykat/finesse.py b/pykat/finesse.py index 6622401..7f8bb77 100644 --- a/pykat/finesse.py +++ b/pykat/finesse.py @@ -131,7 +131,7 @@ class kat(object): def loadKatFile(self, katfile): with open(katfile) as f: - parseCommands(f.readlines()) + self.parseCommands(f.readlines()) def parseCommands(self, commands): blockComment = False @@ -197,18 +197,17 @@ class kat(object): raise MissingFinesse() # create a kat file which we will write the script into - katfile = tempfile.TemporaryFile(suffix=".kat") + katfile = tempfile.NamedTemporaryFile(suffix=".kat") katfile.writelines(r.katScript) katfile.flush() - flags = "--perl1 " - + cmd=[kat_exec, '--perl1'] if self.__time_code: - flags = flags + " --perf-timing --no-backspace" - - kat_exec = "{0} {1} {2}".format(kat_exec, flags, katfile.name) - - p=subprocess.Popen(kat_exec, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + cmd.append('--perf-timing') + cmd.append('--no-backspace') + + cmd.append(katfile.name) + p=subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) err = "" for line in iter(p.stderr.readline, ""): @@ -500,4 +499,4 @@ class kat(object): setattr(self, '__comp_' + comp.name, comp) def __get_component(self, name): - return getattr(self, '__comp_' + name) \ No newline at end of file + return getattr(self, '__comp_' + name) -- GitLab