[Numpy-discussion] pickling arrays: numpy 1.0 can't unpickle numpy 1.0.1

Travis Oliphant oliphant.travis at ieee.org
Thu Dec 7 18:45:48 CST 2006


Emanuele Olivetti wrote:
> I'm running numpy 1.0 and 1.0.1 on several hosts and
> today I've found that pickling arrays in 1.0.1 generates
> problems to 1.0. An example:
> --- numpy 1.0.1 ---
> import numpy
> import pickle
> a = numpy.array([1,2,3])
> f=open('test1.pickle','w')
> pickle.dump(a,f)
> f.close()
> ---
> 
> If I unpickle test1.pickle in numpy 1.0 I got:
> --- numpy 1.0
>  >>> import numpy
>  >>> import pickle
>  >>> f=open('test1.pickle')
>  >>> a=pickle.load(f)
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>    File "/hardmnt/virgo0/sra/olivetti/myapps/lib/python2.5/pickle.py", line 1370, in load
>      return Unpickler(file).load()
>    File "/hardmnt/virgo0/sra/olivetti/myapps/lib/python2.5/pickle.py", line 858, in load
>      dispatch[key](self)
>    File "/hardmnt/virgo0/sra/olivetti/myapps/lib/python2.5/pickle.py", line 1217, in load_build
>      setstate(state)
> TypeError: argument 1 must be sequence of length 5, not 8
> -----------------

Please show which version of numpy you are using.   There were no 
changes to pickle from released numpy 1.0 to 1.0.1  (at least that I'm 
aware of).

There might, however, be bugs.

-Travis



More information about the Numpy-discussion mailing list