我正在尝试通过 zmq ipc 套接字发送现有的 dict,我可以使用此代码发送一个字符串,但我不能发送一个 dict 对象
import zmq, datetime
d = {0: ('356612022462768', 'EVENT', 0, '2012-12-26 15:50:16', -20.22216, -70.13723, 6.44, 134.0, 1, 2, '18743230', datetime.datetime(2013, 2, 10, 9, 6, 2, 362734))}
if __name__ == "__main__":
context = zmq.Context()
publisher = context.socket(zmq.PUB)
publisher.connect("ipc://shared")
while True:
publisher.send( d )
time.sleep( 1 )
TypeError: {0: ('356612022462768', 'EVENT', 0, '2012-12-26 15:50:16',
-20.22216, -70.13723, 6.44, 134.0, 1, 2, '18743230',
datetime.datetime(2013, 2, 10, 9, 6, 2, 362734))}
does not provide a buffer interface.
我怎样才能做到这一点?