[Numpy-discussion] possible bug: pickling MaskedArrays with the latest cvs version of MA

Tavis Rudd tavis at calrudd.com
Fri Mar 23 22:27:45 EST 2001

I'm having difficulty pickling with the new implementation of 
activeattributes in the cvs version of MA.

With the standard pickle module I get the this traceback:
>>> import MA
>>> a = MA.arange(3400)
>>> fp = open('a.pickle','w')
>>> from pickle import dump, load
>>> dump(a,fp)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.1/pickle.py", line 932, in dump
    Pickler(file, bin).dump(object)
  File "/usr/local/lib/python2.1/pickle.py", line 109, in dump
  File "/usr/local/lib/python2.1/pickle.py", line 211, in save
    f(self, object)
  File "/usr/local/lib/python2.1/pickle.py", line 471, in save_inst
    getstate = object.__getstate__
  File "/usr/local/lib/python2.1/site-packages/MA/activeattr.py", line 39, in 
    return d['_get'](self, name)
  File "/usr/local/lib/python2.1/site-packages/MA/activeattr.py", line 80, in 
    return self.__dict__[name]
KeyError: __getstate__

With the cPickle module I'm getting:

>>> from cPickle import dump, load
>>> dump(a,file)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
cPickle.UnpickleableError: Cannot pickle <type 'instance method'> objects

This is with python 2.1b1 and the latest cvs version of Numeric.
Has anyone else had this problem?

More information about the NumPy-Discussion mailing list