Send a Class Object by Socket

Alex Martelli aleax at aleax.it
Tue Jan 8 17:53:07 CET 2002


"Hugo Martires" <hugomartires at hotmail.com> wrote in message
news:d0380df9.0201080844.766e4a00 at posting.google.com...
    ...
> But the server give's me this error:
>
>  File "./serv2.py", line 41, in ?
>     CliSock.send(cPickle.dumps(vp_master) )
> cPickle.PicklingError: Cannot pickle <type 'array'> objects.
>
> Do you know ho to picke an array ?

Not very elegant, maybe, but vp_master.tostring() is
a fully pickleable string of bytes (and the fromstring
method lets you go the other way 'round... although
the typecode character to be used must be passed on
its own, as it's not recoverable from the string).


Alex






More information about the Python-list mailing list