Closed mianchd closed 5 years ago
What version of Python and pickleDB are you using? I was not able to recreate this in my own environment. I recomend using the latest version of pickleDB from the GitHub repo. The PyPI is a little behind.
I am using,
pickleDB==0.8.1 Python==3.5.4
I still am unable to re-create the error.
I am using Python 3.7 and also tested Python 2.7 along with pickleDB 0.9.1 which I just made available on PyPI. Please try using the latest pickleDB release and let me know if the error persists.
Once you have upgraded to 0.9.1 if the error is still happening you may want to change
self.db = json.load(open(self.loco, 'rb'))
to
self.db = json.load(open(self.loco, 'rt'))
and see if that fixes your problem. Please let me know the results.
upgrade to 0.9.2 now available on PyPI
Thanks @patx The issue is resolved.
Traceback (most recent call last): File "", line 1, in
File "C:\Users\Documents\Python Projects\garbage-chatter\venv\lib\site-packages\pickledb.py", line 39, in load
return pickledb(location, auto_dump)
File "C:\Users\Documents\Python Projects\garbage-chatter\venv\lib\site-packages\pickledb.py", line 49, in init
self.load(location, auto_dump)
File "C:\Users\Documents\Python Projects\garbage-chatter\venv\lib\site-packages\pickledb.py", line 79, in load
self._loaddb()
File "C:\Users\Documents\Python Projects\garbage-chatter\venv\lib\site-packages\pickledb.py", line 96, in _loaddb
self.db = json.load(open(self.loco, 'rb'))
File "C:\Users\AppData\Local\Programs\Python\Python35\Lib\json__init.py", line 268, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "C:\Users\AppData\Local\Programs\Python\Python35\Lib\json\init.py", line 312, in loads
s.class.name__))
TypeError: the JSON object must be str, not 'bytes'