lib: Don't suppress errors from inside the DataFile context manager
And fix up the trackdb to check if the file exists before attempting to unpickle. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
2083d00c23
commit
7b901b8380
|
@ -34,7 +34,7 @@ class DataFile:
|
|||
if self.mode == WRITE:
|
||||
self.temp.replace(self.path)
|
||||
self.file = None
|
||||
return True
|
||||
return exp_type == None
|
||||
|
||||
def exists(self):
|
||||
return self.path.exists()
|
||||
|
|
|
@ -65,7 +65,8 @@ def save(*args):
|
|||
def load():
|
||||
global library_paths
|
||||
with data.DataFile(db_file, data.READ) as f:
|
||||
(library.NextID, library_paths) = f.unpickle()
|
||||
if f.exists():
|
||||
(library.NextID, library_paths) = f.unpickle()
|
||||
|
||||
def __register_callbacks():
|
||||
LibraryAdded.register(save)
|
||||
|
|
Loading…
Reference in New Issue