From 01ac2b991622ada2d1d22dcc1452029ae64bca02 Mon Sep 17 00:00:00 2001 From: "Mads M. Pedersen" <mmpe@dtu.dk> Date: Wed, 21 Dec 2016 11:09:41 +0100 Subject: [PATCH] bug fix in process_exec --- wetb/hawc2/simulation.py | 2 +- wetb/utils/process_exec.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wetb/hawc2/simulation.py b/wetb/hawc2/simulation.py index 5b93e7d..fce2cc1 100755 --- a/wetb/hawc2/simulation.py +++ b/wetb/hawc2/simulation.py @@ -176,7 +176,7 @@ class Simulation(object): assert not src.startswith(".."), "%s referes to a file outside the model path\nAll input files be inside model path" % src return src input_patterns = [fmt(src) for src in self.htcFile.input_files() + ([], self.htcFile.turbulence_files())[self.copy_turbulence] + self.additional_files().get('input', [])] - input_files = set([f for pattern in input_patterns for f in glob.glob(os.path.join(self.modelpath, pattern)) if os.path.isfile(f)]) + input_files = set([f for pattern in input_patterns for f in glob.glob(os.path.join(self.modelpath, pattern)) if os.path.isfile(f) and ".hawc2launcher" not in f]) if not os.path.isdir(os.path.dirname(self.modelpath + self.stdout_filename)): os.makedirs(os.path.dirname(self.modelpath + self.stdout_filename)) self.host._prepare_simulation(input_files) diff --git a/wetb/utils/process_exec.py b/wetb/utils/process_exec.py index f9f781a..9782c25 100644 --- a/wetb/utils/process_exec.py +++ b/wetb/utils/process_exec.py @@ -81,9 +81,10 @@ def unix_filename(filename): f_lst = [f_ for f_ in os.listdir(ufn) if f_.lower() == f.lower()] if len(f_lst) > 1: f_lst = [f_ for f_ in f_lst if f_ == f] - if len(f_lst) == 0: + elif len(f_lst) == 0: raise IOError("'%s' not found in '%s'" % (f, ufn)) - ufn = os.path.join(ufn, f_lst[0]) + else: # one match found + ufn = os.path.join(ufn, f_lst[0]) return ufn.replace("\\", "/") -- GitLab