check for file existence before attempting to read the contents.
This commit is contained in:
parent
f76e9b8f77
commit
d837fb7d1b
1 changed files with 6 additions and 5 deletions
11
app/main.py
11
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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue