Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions exopy_hqc_legacy/tasks/tasks/util/save_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,24 @@ def perform(self):
""" Collect all data and write them to file.

"""
# Enable saving to different files
filename = self.format_string(self.filename)
full_folder_path = self.format_string(self.folder)
# Normalize the path to be able to perform comparisons
full_path = os.path.realpath(os.path.join(full_folder_path, filename))

if not self.file_object:
self.initialized = False
elif self.file_object.name == full_path:
self.initialized = True
else:
self.file_object.close()
self.initialized = False

self.old_file = filename

# Initialisation.
if not self.initialized:

full_folder_path = self.format_string(self.folder)
filename = self.format_string(self.filename)
full_path = os.path.join(full_folder_path, filename)
try:
self.file_object = open(full_path, 'wb')
except IOError:
Expand Down