Closed tvkpz closed 8 years ago
As per the example in the README, you should be encoding data by calling msgpack_numpy.packb
; this will return the serialized string rather than the dict. You can decode the string with msgpack_numpy.unpackb
. Feel free to reopen the issue if this doesn't answer your question.
In the example, the type of x_rec after unpacking is 'dict', which is not the same as 'x'. So my question was how can I get back x.
Thank you!
That's strange - the value returned by unpackb in this case should be an ndarray, not a dict. What versions of Python, msgpack-python, and msgpack-numpy are you using?
Python 3.5 msgpack-python==0.4.7 msgpack-numpy==0.3.7
Looks like a Python 3 bug - just uploaded a fix. Try the latest revision from GitHub.
Thanks! Problem is fixed. BTW may I know what exactly you changed.
Sure. b'foo' == 'foo' is True in Python 2 but False in Python 3. Since part of msgpack-numpy relied upon the former assumption, it broke in Python 3.
I am hitting this error after I installed msgpack-numpy using pip. Pip has version 0.3.7 of this library which was uploaded on 2016-03-13, so that is why I am probably getting this bug.
@lebedov if you are in charge of the pip package, could you actualize to the last version?
@subiol: sure, done.
Using msgpack-numpy for the first time. I tried the example but it returns a 'dict'. How do I get back the original numpy ndarray from the 'data' field.
Sorry if this is not the right forum for asking the question.