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:
JavaScript
x
26
26
1
from multiprocessing.managers import SyncManager
2
3
class MyManager(SyncManager): pass
4
class MyClass: pass
5
6
class Wrapper:
7
def set(self, ent):
8
self.ent = ent
9
10
MyManager.register('MyClass', MyClass)
11
MyManager.register('Wrapper', Wrapper)
12
13
if __name__ == '__main__':
14
manager = MyManager()
15
manager.start()
16
17
try:
18
obj = manager.MyClass()
19
lst = manager.list([1,2,3])
20
21
collection = manager.Wrapper()
22
collection.set(lst) # executed fine
23
collection.set(obj) # raises error
24
except Exception as e:
25
raise
26
Error:
JavaScript
1
11
11
1
---------------------------------------------------------------------------
2
Traceback (most recent call last):
3
File "D:Program FilesPython363libmultiprocessingmanagers.py", line 228, in serve_client
4
request = recv()
5
File "D:Program FilesPython363libmultiprocessingconnection.py", line 251, in recv
6
return _ForkingPickler.loads(buf.getbuffer())
7
File "D:Program FilesPython363libmultiprocessingmanagers.py", line 881, in RebuildProxy
8
return func(token, serializer, incref=incref, **kwds)
9
TypeError: AutoProxy() got an unexpected keyword argument 'manager_owned'
10
---------------------------------------------------------------------------
11
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.