From 16ae7278a21905292879586aa3dc4db543be42e9 Mon Sep 17 00:00:00 2001 From: cmos <cmos@dtu.dk> Date: Fri, 23 Nov 2018 12:47:10 +0100 Subject: [PATCH 1/2] Moved copy action --- wetb/hawc2/hawc2_simulation.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/wetb/hawc2/hawc2_simulation.py b/wetb/hawc2/hawc2_simulation.py index f396c6e..7df7213 100644 --- a/wetb/hawc2/hawc2_simulation.py +++ b/wetb/hawc2/hawc2_simulation.py @@ -197,14 +197,6 @@ class Hawc2_Simulation(object): if self.write_directory == self.source_directory and not force_write: raise Exception('Cannot write the contents into the source directory without the write being forced') - # Copying accompanying files: - if not self.accompanying_files is None: - for i, accompanying_file in enumerate(self.accompanying_files): - destination = os.path.join(self.write_directory,self.accompanying_destinations[i]) - destination = os.path.abspath(os.path.realpath(destination)) - if not os.path.isfile(destination): - os.symlink(accompanying_file, destination) - # Get the directory old_home = os.getcwd() @@ -245,6 +237,15 @@ class Hawc2_Simulation(object): is_good = True else: file_obj.written_file = file_obj.original_file + + # Copying accompanying files: + if not self.accompanying_files is None: + for i, accompanying_file in enumerate(self.accompanying_files): + destination = os.path.join(self.write_directory,self.accompanying_destinations[i]) + destination = os.path.abspath(os.path.realpath(destination)) + if not os.path.isfile(destination): + os.symlink(accompanying_file, destination) + # Now write the HTC file self.input_files['htc'][0].written_file = os.path.join(self.write_directory, self.source_name) fout = open_file_in_dir(self.input_files['htc'][0].written_file, 'w') -- GitLab From ac3107f55a9958605dbae165561aed84d475490a Mon Sep 17 00:00:00 2001 From: cmos <cmos@dtu.dk> Date: Thu, 10 Jan 2019 13:27:19 +0100 Subject: [PATCH 2/2] Made some changes to the hawc2.py --- wetb/hawc2/hawc2_simulation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wetb/hawc2/hawc2_simulation.py b/wetb/hawc2/hawc2_simulation.py index 820b1a2..6b704b9 100644 --- a/wetb/hawc2/hawc2_simulation.py +++ b/wetb/hawc2/hawc2_simulation.py @@ -247,11 +247,11 @@ class Hawc2_Simulation(object): if not os.path.isfile(accompanying_file) and not os.path.isdir(accompanying_file): accompanying_file=os.path.join(self.source_directory,accompanying_file) if not os.path.isfile(accompanying_file) and not os.path.isdir(accompanying_file): - raise ValueError('The accompanying file must be contained within the directory of the HTC file, or one of the sub-directories') + raise ValueError('The accompanying file must be contained within the directory of the HTC file, or one of the sub-directories. file: {} not found'.format(accompanying_file)) else: accompanying_file=os.path.abspath(os.path.realpath(accompanying_file)) if not accompanying_file.startswith(self.source_directory): - raise ValueError('The accompanying file must be contained within the directory of the HTC file, or one of the sub-directories') + raise ValueError('The accompanying file must be contained within the directory of the HTC file, or one of the sub-directories. file: {} not found'.format(accompanying_file)) destination=accompanying_file[len(self.source_directory)+1:] self.accompanying_files.append(accompanying_file) self.accompanying_destinations.append(destination) -- GitLab