[Numpy-discussion] Unpickling python 2.2 UserArray objs in python 2.3

sag at hydrosphere.com sag at hydrosphere.com
Thu Jul 22 15:34:11 CDT 2004


I have a large bunch of objects that subclass UserArray from Numeric 
22.  These objects were created and pickled in binary mode in 
Python2.2 and stored in a mysql database on Red hat 8.  

Using Python2.2, I can easily retrieve and unpickle the objects.

I have just upgraded the system to Fedora Core 2 which supplies 
Python 2.3.3.  After much hassle, I have been able to compile Numeric 
1.0 (ver 23) and have tried to unpickle these objects.  Now, I get a 
failure in the loads call.  

The code is:
<retrieve blob from mysql>
import cPickle
obj = cPickle.loads(str(blob))

When this is called, the python interpreter (via IDLE) goes into a 
loop in the UserArray __getattr__ function.(line 198):
return getattr(self.array,attr)

>> File "/usr/lib/python2.3/site-packages/Numeric/UserArray.py" line 
198, in __getattr__
>>    return getattr(self.array,attr)

No other error is reported, just a stack full of these lines.

It seems that at this point, UserArray doesn't know that it has an 
'array' attr.

This worked just fine in Python2.2.

Has something changed in Python2.3 cPickle functions or in how 
Numeric 23 handles pickle/unpickle that would make my Python2.2 blobs 
unusable in Python 2.3?  Is there a solution for this, other than 
remaking my blobs (not an option - there are literally millions of 
them), or must I figure out how to access python2.2 for this code?

So far as I can tell, the string I get back is exactly the same for 
both versions.

Any help you can give me would be appreciated.  Thanks

sue giller





More information about the Numpy-discussion mailing list