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

Tavis Rudd tavis at calrudd.com
Fri Mar 23 21:27:45 CST 2001


Hi,
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
    self.save(object)
  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 
__getattr__
    return d['_get'](self, name)
  File "/usr/local/lib/python2.1/site-packages/MA/activeattr.py", line 80, in 
basic_get
    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?
Tavis




More information about the Numpy-discussion mailing list