MrPigss / BetterJSONStorage

Better JSONStorage for tinyDB
https://pypi.org/project/BetterJSONStorage/
MIT License
30 stars 3 forks source link

Error RuntimeError: Cannot decompress #5

Open dodolboks opened 1 year ago

dodolboks commented 1 year ago

Hi, i want to try but find exception like bellow

from pathlib import Path from tinydb import TinyDB from BetterJSONStorage import BetterJSONStorage path = Path('test2.json') with TinyDB(path, access_mode="r+", storage=BetterJSONStorage) as db: ... dc = db.search(where("groups") != None) ... Traceback (most recent call last): File "", line 1, in File "/home/doodlboks/riset/bispes/lib/python3.8/site-packages/tinydb/database.py", line 94, in init self._storage: Storage = storage(*args, **kwargs) File "/home/doodlboks/riset/bispes/lib/python3.8/site-packages/BetterJSONStorage/BetterJSONStorage.py", line 128, in init self.load() File "/home/doodlboks/riset/bispes/lib/python3.8/site-packages/BetterJSONStorage/BetterJSONStorage.py", line 170, in load self._data = loads(decompress(db_bytes)) File "/home/doodlboks/riset/bispes/lib/python3.8/site-packages/blosc2/core.py", line 177, in decompress return blosc2_ext.decompress(src, dst, as_bytearray) File "blosc2_ext.pyx", line 404, in blosc2.blosc2_ext.decompress RuntimeError: Cannot decompress

nikhil-swamix commented 10 months ago

same here any solution found?

nikhil-swamix commented 10 months ago

ok i found solution, delete any old database, if you are trying to use db.json created with native lib re-create it.

MrPigss commented 10 months ago

I should probably mention it in the docs that you can't (easily) transfer databases created with other Storage types.