This seems to be a python 3.6
bug
When assigning a manager.Queue
to a manager.Namespace
attribute one gets an TypeError
. To reproduce it is simple:
>>> from multiprocessing import Manager
>>> manager = Manager()
>>> np = manager.Namespace()
>>> np.shared_queue = manager.Queue()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\users\leonardo.schettini\appdata\local\programs\python\python36-32\Lib\multiprocessing\managers.py", line 1065, in __setattr__
return callmethod('__setattr__', (key, value))
File "c:\users\leonardo.schettini\appdata\local\programs\python\python36-32\Lib\multiprocessing\managers.py", line 772, in _callmethod
raise convert_to_error(kind, result)
multiprocessing.managers.RemoteError:
---------------------------------------------------------------------------
Traceback (most recent call last):
File "c:\users\leonardo.schettini\appdata\local\programs\python\python36-32\Lib\multiprocessing\managers.py", line 228, in serve_client
request = recv()
File "c:\users\leonardo.schettini\appdata\local\programs\python\python36-32\Lib\multiprocessing\connection.py", line 251, in recv
return _ForkingPickler.loads(buf.getbuffer())
File "c:\users\leonardo.schettini\appdata\local\programs\python\python36-32\Lib\multiprocessing\managers.py", line 881, in RebuildProxy
return func(token, serializer, incref=incref, **kwds)
TypeError: AutoProxy() got an unexpected keyword argument 'manager_owned'
---------------------------------------------------------------------------
Here, I found that manager.Queue
is just
an address (proxy) pointing to shared queue managed by the multiprocessing.Manager() object
If one tries to assign a multiprocessing.Queue
instead a RuntimeError
is raised. This makes sense if you consider that the multiprocessing.Queue
can't be pickled (information on provided link)