[Zope] array module and pickleing ques

Aseem Mohanty aseem@neurobehavioralsystems.com
Tue, 09 Jul 2002 22:55:00 -0700

some more info: the error:

Error Type: UnpickleableError
Error Value: Cannot pickle objects


Troubleshooting Suggestions

   * The URL may be incorrect.
   * The parameters passed to this resource may be incorrect.
   * A resource that this resource relies on may be encountering an error.

For more detailed information about the error, please refer to the HTML 
source for this page.

If the error persists please contact the site maintainer. Thank you for 
your patience.

Traceback (innermost last):
 File F:\KANDIN~1\lib\python\ZPublisher\Publish.py , line 150, in 
 File F:\KANDIN~1\lib\python\ZPublisher\Publish.py , line 114, in publish
 File F:\KANDIN~1\lib\python\Zope\__init__.py , line 158, in 
 File F:\KANDIN~1\lib\python\ZPublisher\Publish.py , line 102, in publish
 File F:\KANDIN~1\lib\python\Zope\__init__.py , line 172, in commit
 File f:\kandinsky\lib\python\Products\TransactionAgents\__init__.py , 
line 54, in new_commit
 File F:\KANDIN~1\lib\python\ZODB\Transaction.py , line 233, in commit
 File F:\KANDIN~1\lib\python\ZODB\Connection.py , line 345, in commit
   (Info: (('Products.RC2.RC2', 'RC2'), '\x00\x00\x00\x00\x00\x00h\xe1', 
UnpickleableError: (see above)

I also tried the following in the python console:

Python 2.1.2 (#31, Jan 15 2002, 17:28:11) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
 >>> import pickle, array, os
 >>> f= open('test','w')
 >>> x = array.array('H')
 >>> pickle.dump(x,f)
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "F:\KANDIN~1\bin\lib\pickle.py" , line 939, in dump
   Pickler(file, bin).dump(object)
 File "F:\KANDIN~1\bin\lib\pickle.py" , line 109, in dump
 File "F:\KANDIN~1\bin\lib\pickle.py" , line 171, in save
   raise PicklingError, \
pickle.PicklingError: can't pickle 'array' object: array('H')

The problem is that I NEED that array sizes to be 1 or 2 bytes  and I 
dont know how to get around this problem without arrays.

Any help would be greatly appreciated.


Aseem Mohanty wrote:

> why does a call to array.array() cause an unpickleable error??
> the pickle docs on the python site dont mention anything about arrays, 
> nor do the array docs mention about pickling.
> i have a feeling that it might be because of the fact that arrays are 
> dynamic data structures and thus the pickler doesnt really know about 
> its limits (of course I could be totally and miserably  wrong) i 
> couldnt find anything in the docs to support my 'feeling' and the 
> source is kind of above my current level of expertise in python
> any help would be appreciated or i am doomed to a major rewrite....
> the source in my product that causes the error :
> self.K=array.array('H')
> self.L=array.array('B')
> self.R=array.array('H')
> AM

 Aseem Mohanty							   
 Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 
 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231		  	
 "I saw `cout' being shifted "Hello world" times to the left and  
  stopped right there!!"                        -- Steve Gonedes