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

Emanuele Olivetti olivetti at itc.it
Thu Dec 7 05:30:15 EST 2006


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
-----------------

How can I let access pickled arrays made in numpy 1.0.1 to numpy 1.0 ?
Help!

Thanks in advance,

Emanuele



More information about the NumPy-Discussion mailing list