i wanted run example code (unmodified) https://docs.python.org/3/library/multiprocessing.html#customized-managers:
from multiprocessing.managers import basemanager class mathsclass: def add(self, x, y): return x + y def mul(self, x, y): return x * y class mymanager(basemanager): pass mymanager.register('maths', mathsclass) if __name__ == '__main__': mymanager() manager: maths = manager.maths() print(maths.add(4, 3)) # prints 7 print(maths.mul(7, 8)) # prints 56
however, gives error:
traceback (most recent call last): file "multithreadingbasexample.py", line 25, in <module> print(maths.mul(7, 8)) # prints 56 file "c:\anaconda2\lib\multiprocessing\managers.py ", line 602, in __exit__ self.shutdown() attributeerror: 'mymanager' object has no attribute 'shutdown'
whats wrong?
system: windows 7 64bit, python 2.7.13 |anaconda custom (64-bit)| (default, dec 19 2016, 13:29:36) [msc v.1500 64 bit (amd64)], multiprocessing 0.70a1
Comments
Post a Comment