File can already exist if there was a previous problem running the script
This commit is contained in:
mike cullerton 2021-09-15 10:30:12 -04:00
parent 02de382b8b
commit c335390025
1 changed files with 4 additions and 0 deletions

View File

@ -32,6 +32,10 @@ class GetZippedFiles(Script):
else: else:
zip_filename = 'attachments.zip' 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'] file_ids = kwargs['file_ids']
files = session.query(FileModel).filter(FileModel.id.in_(file_ids)).all() files = session.query(FileModel).filter(FileModel.id.in_(file_ids)).all()
if files: if files: