Skip to content

Commit

Permalink
remove one zf.close()
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Oct 18, 2023
1 parent e72be67 commit 531f77b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions antareslauncher/use_cases/retrieve/final_zip_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ def extract_final_zip(self, study: StudyDTO) -> None:
)
for file in progress_bar:
zf.extract(member=file, path=target_dir)
zf.close()
else:
zf.close()
# The directory is already an output and does not need to be unzipped.
# All we have to do is rename it by removing the prefix "_finished"
# and the suffix "job_id" that lies before the ".zip".
# If these prefix/suffix prefix change, this code needs to be adapted.
zf.close()
zip_path.rename(zip_path.parent / (zip_path.name[9:zip_path.name.rfind("_")] + ".zip"))

except (OSError, zipfile.BadZipFile) as exc:
Expand Down

0 comments on commit 531f77b

Please sign in to comment.