diff --git a/wetb/hawc2/simulation.py b/wetb/hawc2/simulation.py index 4de23bab686aa8cf30b68baeae3266dfabbee2b6..01ae9412adf0d6484edc853c88a334f862abaf83 100755 --- a/wetb/hawc2/simulation.py +++ b/wetb/hawc2/simulation.py @@ -458,11 +458,7 @@ class SimulationThread(Thread): stdout = self.sim.stdout_filename if not os.path.isdir(os.path.dirname(self.modelpath + self.sim.stdout_filename)): os.makedirs(os.path.dirname(self.modelpath + self.sim.stdout_filename)) - #if os.name == "nt": - # self.process = subprocess.Popen('"%s" %s 1> %s 2>&1' % (hawc2exe, htcfile, stdout), stdout=None, stderr=None, shell=True, cwd=modelpath) #, creationflags=CREATE_NO_WINDOW) - #else: - # self.process = subprocess.Popen('wine "%s" %s 1> %s 2>&1' % (hawc2exe, htcfile, stdout), stdout=None, stderr=None, shell=True, cwd=modelpath) - + with open (os.path.join(self.modelpath, stdout), 'wb') as stdout: if isinstance(hawc2exe, tuple): wine, hawc2exe = hawc2exe @@ -471,15 +467,6 @@ class SimulationThread(Thread): self.process = subprocess.Popen([hawc2exe, htcfile], stdout=stdout, stderr=STDOUT, shell=False, cwd=modelpath) #, creationflags=CREATE_NO_WINDOW) self.process.communicate() - -# if isinstance(hawc2exe, tuple): -# self.process = subprocess.Popen('%s "%s" %s 1> %s 2>&1' % (hawc2exe + (htcfile, stdout)), stdout=None, stderr=None, shell=False, cwd=modelpath) -# else: -# self.process = subprocess.Popen('"%s" %s 1> %s 2>&1' % (hawc2exe, htcfile, stdout), stdout=None, stderr=None, shell=False, cwd=modelpath) #, creationflags=CREATE_NO_WINDOW) -# with open("cmd.txt", 'w') as fid: -# fid.write("cd %s\n" % modelpath) -# fid.write('"%s" %s 1> %s 2>&1' % (hawc2exe, htcfile, stdout)) - import psutil try: self.sim.host.resource.process_name = psutil.Process(self.process.pid).name() diff --git a/wetb/utils/caching.py b/wetb/utils/caching.py index 84a38a69b5a171244a2aadc4519cbacb3415646a..1ca38d4bf4d77251898cfdd9921fbdb3c5828702 100644 --- a/wetb/utils/caching.py +++ b/wetb/utils/caching.py @@ -35,6 +35,8 @@ def set_cache_property(obj, name, get_func, set_func=None): >>> e = Example() >>> e.test # Call, store and return result of e.slow_function >>> e.test # Return stored result of e.slow_function + >>> e._test = None # clear cache result + >>> e.test # Call, store and return result of e.slow_function """ _name = "_" + name setattr(obj, _name, None) diff --git a/wetb/utils/cython_compile/cython_compile.py b/wetb/utils/cython_compile/cython_compile.py index 1e17e16f68208962ccf5a20e72efe528e29c178b..f66ab60aaefc7eeb3fe9b9f6886c2e19084235d5 100644 --- a/wetb/utils/cython_compile/cython_compile.py +++ b/wetb/utils/cython_compile/cython_compile.py @@ -382,7 +382,8 @@ def py2pyx(pylines): cdef = l[l.index("#c") + 1:] l = indent + cdef if "__future__" in l: - pyxlines.insert(0, l) # from __future__ import ... must be first + #pyxlines.insert(0, l) # from __future__ import ... must be first + pass else: pyxlines.append(l) return pyxlines