Allow library to load empty
This commit is contained in:
parent
6638260031
commit
89e0c1838a
10
badwitch.py
10
badwitch.py
@ -25,9 +25,13 @@ class Library:
|
||||
|
||||
# Load from file
|
||||
def load(self):
|
||||
with open(self.file, 'r+') as libfd:
|
||||
libfd.seek(0)
|
||||
self.albums = json.load(libfd)
|
||||
try:
|
||||
with open(self.file, 'r+') as libfd:
|
||||
libfd.seek(0)
|
||||
self.albums = json.load(libfd)
|
||||
except FileNotFoundError:
|
||||
logging.debug('Could not find library, loading empty')
|
||||
self.albums = {}
|
||||
return
|
||||
|
||||
# Save to file
|
||||
|
Loading…
Reference in New Issue
Block a user