I do not know why, but I get this strange error whenever I try to pass to the method of a shared object shared custom class object. Python version: 3.6.3
Code:
from multiprocessing.managers import SyncManager class MyManager(SyncManager): pass class MyClass: pass class Wrapper: def set(self, ent): self.ent = ent MyManager.register('MyClass', MyClass) MyManager.register('Wrapper', Wrapper) if __name__ == '__main__': manager = MyManager() manager.start() try: obj = manager.MyClass() lst = manager.list([1,2,3]) collection = manager.Wrapper() collection.set(lst) # executed fine collection.set(obj) # raises error except Exception as e: raise
Error:
--------------------------------------------------------------------------- Traceback (most recent call last): File "D:Program FilesPython363libmultiprocessingmanagers.py", line 228, in serve_client request = recv() File "D:Program FilesPython363libmultiprocessingconnection.py", line 251, in recv return _ForkingPickler.loads(buf.getbuffer()) File "D:Program FilesPython363libmultiprocessingmanagers.py", line 881, in RebuildProxy return func(token, serializer, incref=incref, **kwds) TypeError: AutoProxy() got an unexpected keyword argument 'manager_owned' ---------------------------------------------------------------------------
What’s the problem here?
Advertisement
Answer
Found temporary solution here. I’ve managed to fix it by adding needed keyword to initializer of AutoProxy in multiprocessingmanagers.py Though, I don’t know if this kwarg is responsible for anything.