From ad3a8ec876067761622609342ba2ebe923990efa Mon Sep 17 00:00:00 2001 From: Mark Do Date: Sat, 15 Jun 2024 01:36:04 +0000 Subject: [PATCH] fixed temp dir bug --- src/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index d99d8c5..e5f82b1 100644 --- a/src/main.py +++ b/src/main.py @@ -8,6 +8,7 @@ S3CFG_TEMP_PATH = FILE_PATH + "/s3cfg_temp" S3_TEMP = "s3://asset-temp" S3_PERM = "s3://asset-perm" +TEMP_ASSET_DIR = "temp" bucket_map = { S3_TEMP: S3CFG_TEMP_PATH, @@ -147,7 +148,6 @@ def delete_file(filename, bucket): def transfer_file(filename, from_bucket, to_bucket): # Download file - tmp_dir = "temp" download_file(filename, tmp_dir + "/" + filename, from_bucket) # Delete file in the old bucket @@ -190,4 +190,8 @@ def clean_bucket(): run_command(f's3cmd --config={bucket_map[S3_TEMP]} del {S3_TEMP}/{asset}') if __name__ == "__main__": + # Make temp dir for assets if needed. + os.makedirs(TEMP_ASSET_DIR, exist_ok=True) + + # Run script manage_assets() \ No newline at end of file