diff --git a/main.py b/main.py index f9ee5c5..839e8c8 100644 --- a/main.py +++ b/main.py @@ -199,9 +199,7 @@ def unpack_pictures_zip(file: UploadFile, time): import os print(f"Accepted {file.filename} at {time} into processing") - os.chdir(DATA_LOCATION) - os.makedirs("processing", exist_ok=True) - os.chdir("processing") + os.makedirs(os.path.join(DATA_LOCATION, "processing"), exist_ok=True) # using private ._file field is a dirty hack, but # SpooledTemporaryFile does not implement seekable @@ -210,7 +208,10 @@ def unpack_pictures_zip(file: UploadFile, time): with zipfile.ZipFile(file.file._file) as photo_zip: problem_files = photo_zip.testzip() if problem_files is not None: - print(f"Errors in {file.filename} accepted at {time}: {problem_files}") - photo_zip.extractall() + print(f"Errors in {file.filename} from {time} at {problem_files}") + photo_zip.extractall(path=os.path.join(DATA_LOCATION, "processing")) photo_zip.close() - print(f"Succesfully processed {file.filename} accepted at {time}") + + print(f"Start processing {file.filename} from {time}") + + print(f"Succesfully processed {file.filename} from {time}")