diff --git a/pickledb.py b/pickledb.py index 8ff5552..f4633eb 100644 --- a/pickledb.py +++ b/pickledb.py @@ -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): @@ -295,4 +299,3 @@ def deldb(self): self.db = {} self._autodumpdb() return True -