Closed alison-f-cooper closed 6 years ago
Please specify what versions of msgpack-python, msgpack-numpy, and Python you are using; I can't reproduce this problem with msgpack-python 0.4.8, msgpack-numpy 0.4.1, and Python 2.7.14 or 3.6.3.
Sorry I forgot to include that. We are using msgpack-python 0.4.8 and msgpack-numpy 0.4.1, as you tested. Due to constraints from another team we need to integrate with, we're on Python 3.5.1.
Still can't replicate; the following code runs without error:
import msgpack_numpy as msg
import numpy as np
data = np.array([0])
s = msg.packb(data, use_bin_type=True)
assert s is not None
np.testing.assert_array_equal(msg.unpackb(s), data)
Here is the environment.yml file for the conda environment I used to test the above:
name: MSGPACK
channels:
- conda-forge
- defaults
dependencies:
- blas=1.1=openblas
- ca-certificates=2017.11.5=0
- certifi=2017.11.5=py35_0
- decorator=4.1.2=py35_0
- ipython=6.2.1=py35_0
- ipython_genutils=0.2.0=py35_0
- jedi=0.10.2=py35_0
- msgpack-numpy=0.4.1=py_0
- msgpack-python=0.4.8=py35_0
- numpy=1.13.3=py35_blas_openblas_201
- openblas=0.2.20=4
- openssl=1.0.2m=0
- pexpect=4.3.0=py35_0
- pickleshare=0.7.4=py35_0
- pip=9.0.1=py35_0
- prompt_toolkit=1.0.15=py35_0
- ptyprocess=0.5.2=py35_0
- pygments=2.2.0=py35_0
- python=3.5.1=1
- readline=6.2=0
- setuptools=37.0.0=py35_0
- simplegeneric=0.8.1=py35_0
- six=1.11.0=py35_1
- sqlite=3.9.2=0
- tk=8.5.19=2
- traitlets=4.3.2=py35_0
- wcwidth=0.1.7=py35_0
- wheel=0.30.0=py_1
- xz=5.0.5=1
- zlib=1.2.11=0
- libgfortran=3.0.0=1
- ncurses=5.9=5
- pip:
- ipython-genutils==0.2.0
- prompt-toolkit==1.0.15
prefix: /home/lebedov/miniconda
Please reopen if this is still a problem.
I've only seen this come up in this particular case, and it's a bit strange. If I try to encode numpy array containing just 0 (
np.array([0])
),None
is returned. I am usingmsgpack.packb(value, use_bin_type=True)
, where value is the numpy array. If I add some more structure to it, like putting it in a json blob, e.g.{ 'data': np.array([0]) }
, it works fine. I do not see this problem with other integers, likenp.array([1])
.