[Zope] array module and pickleing ques
Aseem Mohanty
aseem@neurobehavioralsystems.com
Wed, 10 Jul 2002 05:26:21 -0700
That seems to be the answer. However I tried Charlie's suggestions and
made the data members as lists (not strings as he suggested, seemed to
work equally well and I didnt have to switch back and forth between
functions calls) instead of arrrays and only instantiated arrays where I
needed to use them (only inside of functions) as local variables.
Well it doesnt work. Everytime that function (that has an array
declaration inside) is called I get another UnpickleableError.
I am at my wit's end... how do I get around it or force it through...
any help would greatly appreciated.
one function that raises that error:
def _reverse_hex(self,s):
x=array.array('c',s) ## causes the error .... no problems if I
remove it
for i in range(0,len(s),4):
a=x[i]
b=x[i+1]
c=x[i+2]
d=x[i+3]
x[i]=c
x[i+1]=d
x[i+2]=a
x[i+3]=b
return x.tostring()
TIA
AM
Dieter Maurer wrote:
>Aseem Mohanty writes:
> > why does a call to array.array() cause an unpickleable error??
>Probably, because it is not a standard Python class but implemented
>in "C" and the author did not provide "setstate/getstate" methods.
>
>Pickling means serializing. Apparently, the pickle modules does
>not know how to serialize "array"s.
>
>
>Dieter
>
>.
>
--
==================================================================
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
==================================================================