From 87f7cc763f0cdfdfa5d051177bc8c4289bb55b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Sun, 17 Aug 2025 00:51:50 +0200 Subject: [PATCH] Handle file not found error during file processing --- twitch/management/commands/import_drops.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/twitch/management/commands/import_drops.py b/twitch/management/commands/import_drops.py index caf47d2..8997111 100644 --- a/twitch/management/commands/import_drops.py +++ b/twitch/management/commands/import_drops.py @@ -244,6 +244,8 @@ class Command(BaseCommand): else: self.stdout.write(f"{file_path!s} already exists in {processed_path!s}, removing original file.") file_path.unlink() + except FileNotFoundError: + self.stdout.write(f"{file_path!s} not found, skipping.") except (PermissionError, OSError, shutil.Error) as e: self.stdout.write(self.style.ERROR(f"Error moving {file_path!s} to {processed_path!s}: {e}")) traceback.print_exc() @@ -547,6 +549,7 @@ class Command(BaseCommand): # If not found, move the file for manual review self.stdout.write(self.style.WARNING("No organization found for this campaign, moving file for review.")) + todo_dir: Path = Path("check_these_please") todo_dir.mkdir(parents=True, exist_ok=True) self.move_file(