check for file existence before attempting to read the contents.

This commit is contained in:
ArabCoders 2024-10-31 23:46:08 +03:00
parent f76e9b8f77
commit d837fb7d1b

View file

@ -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: