UniNE-CHYN / mmappickle

Python 3 library to store memory mappable objects into pickle-compatible files
http://mmappickle.readthedocs.io
GNU Lesser General Public License v3.0
37 stars 4 forks source link

int64 error #17

Open BorisMansencal opened 1 year ago

BorisMansencal commented 1 year ago

The following code does not work:

import numpy as np
from mmappickle import mmapdict

m = mmapdict("/tmp/test.mmdpickle")                                                                                                                                                              
a = np.array(1234, dtype=np.int64)
m['a'] = a

print("type m[a]=", type(m['a']))

I get the following error:

Traceback (most recent call last):
  File "/tmp/dbg.py", line 13, in <module>
    print("type m[a]=", type(m['a']))
  File "/usr/local/lib/python3.8/dist-packages/mmappickle/utils.py", line 53, in lock_wrapper
    return f(self, *a, **kw)
  File "/usr/local/lib/python3.8/dist-packages/mmappickle/dict.py", line 613, in __getitem__
    return pickler.read(data_offset, data_length)[0]
  File "/usr/local/lib/python3.8/dist-packages/mmappickle/utils.py", line 11, in save_file_position_wrapper
    return f(self, *a, **kw)
  File "/usr/local/lib/python3.8/dist-packages/mmappickle/picklers/numpy.py", line 115, in read
    assert False, "Invalid element type: 0x{:02x}".format(ord(shapeelementtype))
AssertionError: Invalid element type: 0x29

tested on Ubuntu 20.04 with python 3.8.10 and numpy 1.23.5.