帮助腌制工具 [英] help on pickle tool

查看:49
本文介绍了帮助腌制工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有使用

XMLRPC协议用python编写的客户端 - 服务器应用程序。现有客户端是命令行。现在客户端

应用程序我们正在使用java将其转换为Web UI。我在编写java客户端时看到了一些

的问题。在来自

客户端的每个请求的服务器上,服务器在哈希表中发送响应并使用pickle序列化

。我们在服务器上调用的python函数是


pickle.dumps(r,2) - 其中r是一个哈希表,需要

序列化


在客户端(python中的现有客户端),我们使用此调用

获取原始数据。


r = pickle.loads(结果)


由于我使用java编写此客户端作为Web UI客户端,我不是

能够反序列化这些数据

使用java函数" ObjectInputStream"和ObjectInputStream其中

是最常见的反序列化函数,我收到错误

无效的标题。


是否可以反序列化数据通过由/ b $ b $ Python序列化的java或者是否有任何兼容性问题。在java上是否有支持此操作的等效的
pickle工具。所以我可以跨语言使用




由于这个问题,我无法继续下去。任何机构都有这个问题的任何指针

。任何帮助都非常感谢


提前致谢


问候

Virg

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

推荐答案

2006年10月5日21:52:56 -0700,virg< 06 **** @ gmail.comwrote:
On 5 Oct 2006 21:52:56 -0700, virg <06****@gmail.comwrote:



i有使用

XMLRPC协议用python编写的客户端 - 服务器应用程序。现有客户端是命令行。现在客户端

应用程序我们正在使用java将其转换为Web UI。我在编写java客户端时看到了一些

的问题。在来自

客户端的每个请求的服务器上,服务器在哈希表中发送响应并使用pickle序列化

。我们在服务器上调用的python函数是...
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...



我们在谈论什么样的数据?它是严格的字典/

列表内容还是更复杂(函数和其他对象)?我可以

看到2个可能的选项:Jython或YAML。 (我一直在回答很多

的问题:今天序列化并在所有人中提到了YAML

:))

What kind of data are we talking about? Is it strictly dictionary /
list stuff or is it more complex (functions & other objects)? I can
see 2 possible options: Jython or YAML. (I have been answering a lot
of questions re: serialization today and mentioned YAML in all of them
:))

virg写道:
virg wrote:



i有客户端 - 服务器应用程序,用python编写,使用

XMLRPC协议。现有客户端是命令行。现在客户端

应用程序我们正在使用java将其转换为Web UI。我在编写java客户端时看到了一些

的问题。在来自

客户端的每个请求的服务器上,服务器在哈希表中发送响应并使用pickle序列化

。我们在服务器上调用的python函数是


pickle.dumps(r,2) - 其中r是一个哈希表,需要

序列化


在客户端(python中的现有客户端),我们使用此调用

获取原始数据。


r = pickle.loads(结果)


由于我使用java编写此客户端作为Web UI客户端,我不是

能够反序列化这些数据

使用java函数" ObjectInputStream"和ObjectInputStream其中

是最常见的反序列化函数,我收到错误

无效的标题。


是否可以反序列化数据通过由/ b $ b $ Python序列化的java或者是否有任何兼容性问题。在java上是否有支持此操作的等效的
pickle工具。所以我可以跨语言使用




由于这个问题,我无法继续下去。任何机构都有这个问题的任何指针

。非常感谢任何帮助


提前致谢


问候

Virg
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



您可以尝试使用不同的pickle格式化程序来选择数据,这可能是您可以使用的
。也许是一个XML pickler

http://www.gnosis.cx/download/Gnosis...1.2.1.ANNOUNCE

我未经测试。)

你也可能使用JSON / YAML pickler。 JSON现在是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。

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...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.


2006年10月5日22:25:58 -0700,Paddy< pa ** *****@netscape.netwrote:
On 5 Oct 2006 22:25:58 -0700, Paddy <pa*******@netscape.netwrote:

您可能会尝试使用不同的pickle格式化程序选择数据,这可能是您的Java可以使用的
。也许是一个XML pickler

http://www.gnosis.cx/download/Gnosis...1.2.1.ANNOUNCE

我未经测试。)

你也可能使用JSON / YAML pickler。 JSON现在是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/



为什么是子集?

Why a subset?


这篇关于帮助腌制工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆