Skip to content

Commit

Permalink
Update load in pickledb.py
Browse files Browse the repository at this point in the history
Amending an error when loading pickeldb just after successful attempt patx#92
  • Loading branch information
ts0924 authored Nov 9, 2023
1 parent 68b24d6 commit a6aec5c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pickledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@
from tempfile import NamedTemporaryFile
from threading import Thread


def load(location, auto_dump, sig=True):
def load(location, auto_dump, sig = True):
'''Return a pickledb object. location is the path to the json file.'''
return PickleDB(location, auto_dump, sig)

db = False
while db == False:
try:
db = PickleDB(location, auto_dump, sig)
except:
db = False
return db

class PickleDB(object):

Expand Down Expand Up @@ -295,4 +299,3 @@ def deldb(self):
self.db = {}
self._autodumpdb()
return True

0 comments on commit a6aec5c

Please sign in to comment.