TypeError:需要类似字节的对象,而不是' Binary'

时间:2016-05-29 15:15:32

标签: python pickle

我使用xmlrpc.server构建服务器并使用pickle.dumps()来挑选一些数据。然后我使用xmlrpc.client构建一个客户端并使用pickle.loads()来取消这些数据,但我反击了以下问题:

I don't know the difference between the bytes-like object and 'Binary'

I try to use bytes(ret) to solve this problem,but it has another one

1 个答案:

答案 0 :(得分:2)

鉴于Binary实例bin,您可以按bytes将数据作为bytearraybin.data实例获取。

我只能从您提供的代码段中猜出,但以下情况应该有效:

ret = pickle.loads(ret.data)