I have a very simple queue which is used between Python3 modules in Raspberry Pi. I want to send messages to the same queue from one Python2 module. Does not work.
Server is running in Python3 as in this example:
from multiprocessing.managers import BaseManager
import Queue
queue = Queue.Queue()
class QueueManager(BaseManager): pass
QueueManager.register('get_queue', callable=lambda:queue)
m = QueueManager(address=('', 50000), authkey='abracadabra')
s = m.get_server()
s.serve_forever()
Sender is like this:
from multiprocessing.managers import BaseManager
class QueueManager(BaseManager): pass
QueueManager.register('get_queue')
m = QueueManager(address=('foo.bar.org', 50000), authkey='abracadabra')
m.connect()
queue = m.get_queue()
queue.put('hello')
With both only in Python3 or in Python2 everything runs perfectly. If server is in Python3 and sender is in Python2, result is the following error:
Blockquote
Traceback (most recent call last): File "sender_V2.py", line 22, in m.connect() File "/usr/lib/python2.7/multiprocessing/managers.py", line 501, in connect >dispatch(conn, None, 'dummy') File "/usr/lib/python2.7/multiprocessing/managers.py", line 102, in dispatch >kind, result = c.recv() ValueError: unsupported pickle protocol: 3