From d837fb7d1bed01e285cc69a474b74589284c3cd7 Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Thu, 31 Oct 2024 23:46:08 +0300 Subject: [PATCH] check for file existence before attempting to read the contents. --- app/main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/main.py b/app/main.py index 9dddcdd3..105367d0 100644 --- a/app/main.py +++ b/app/main.py @@ -667,11 +667,12 @@ class Main: manual_archive = self.config.manual_archive if manual_archive: previouslyArchived = False - with open(manual_archive, 'r') as f: - for line in f.readlines(): - if idDict['archive_id'] in line: - previouslyArchived = True - break + if os.path.exists(manual_archive): + with open(manual_archive, 'r') as f: + for line in f.readlines(): + if idDict['archive_id'] in line: + previouslyArchived = True + break if not previouslyArchived: with open(manual_archive, 'a') as f: