From c335390025f68412b079a1ceca4a6e6388766784 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Wed, 15 Sep 2021 10:30:12 -0400 Subject: [PATCH] Bug fix. File can already exist if there was a previous problem running the script --- crc/scripts/get_zipped_files.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crc/scripts/get_zipped_files.py b/crc/scripts/get_zipped_files.py index de16e290..614cdb09 100644 --- a/crc/scripts/get_zipped_files.py +++ b/crc/scripts/get_zipped_files.py @@ -32,6 +32,10 @@ class GetZippedFiles(Script): else: zip_filename = 'attachments.zip' + # Delete the temporary zipfile if it already exist + if os.path.exists(zip_filename): + os.remove(zip_filename) + file_ids = kwargs['file_ids'] files = session.query(FileModel).filter(FileModel.id.in_(file_ids)).all() if files: