help on pickle tool

Paddy paddy3118 at netscape.net
Fri Oct 6 01:25:58 EDT 2006


virg wrote:
> Hi,
>      i have client-server application which is written in python using
> XMLRPC protocol. The existing client is a command line. Now client
> application we are converting it as Web UI using java. I have seen some
> problems in writing a java client. At the server for each request from
> client, the server sends a response in hashtable and is serialized
> using "pickle". The python function we call at the server is
>
> pickle.dumps(r, 2)  -- where r is a hash table which needs to be
> serialized
>
> At the client (existing client  which in python) we use this call to
> get the original data.
>
> r = pickle.loads(result)
>
> Since i am writing this client as Web UI client using java, i am not
> able to deserialize this data
> using java function "ObjectInputStream" and "ObjectInputStream" which
> are most common functions for deserialization and i getting error as
> invalid header.
>
> Is it possible to deserialize the data by java  which serialized by
> Python or is there any compatibility issue. Is there any equivalent
> pickle tool on java which supports this operation. so that i can use
> across languages.
>
> Because of this problem i am not able to proceed further. Any body has
> any pointers for this problem. Any help is highly appreciated
>
> Thanks in advance
>
> regards
> Virg
You might try picking the data with a different pickle formatter that
your Java can use. Maybe an XML pickler
(http://www.gnosis.cx/download/Gnosis_Utils.More/Gnosis_Utils-1.2.1.ANNOUNCE
untested by me).
You might also use a JSON/YAML pickler. JSON is now a subset of YAML:
  http://cheeseshop.python.org/pypi/python-json/3.4
  http://pyyaml.org/wiki/PyYAML
  http://jyaml.sourceforge.net/
  http://www.yaml.org/
  http://www.json.org/
  http://www.json.org/java/

- Paddy.




More information about the Python-list mailing list