问题
Below is my code , for which i am facing a multiprocessing issue. I see this question has been asked before and i have tried those solutions but it does not seem to work. Can someone help me out here ?
from multiprocessing import Pool, Manager
Class X:
def _init_():
def method1(number1,var_a, var_b, var_c, var_d):
return values
if __name__ == 'main':
for value in ["X", "Y"]:
dict_values = Manager().dict()
with Pool(1) as p:
p.starmap(method1,
[
(1, dict_values, var_a, var_b, var_c, var_d),
(2, dict_values, var_a, var_b, var_c, var_d),
(3, var_a, var_b, var_c, var_d)
])
The error i face
multiprocessing.pool.RemoteTraceback:
Traceback (most recent call last):
File "/usr/lib64/python3.6/multiprocessing/managers.py", line 749, in _callmethod
conn = self._tls.connection
AttributeError: 'ForkAwareLocal' object has no attribute 'connection'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/usr/lib64/python3.6/multiprocessing/pool.py", line 47, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "<string>", line 2, in __setitem__
File "/usr/lib64/python3.6/multiprocessing/managers.py", line 753, in _callmethod
self._connect()
File "/usr/lib64/python3.6/multiprocessing/managers.py", line 740, in _connect
conn = self._Client(self._token.address, authkey=self._authkey)
File "/usr/lib64/python3.6/multiprocessing/connection.py", line 487, in Client
c = SocketClient(address)
File "/usr/lib64/python3.6/multiprocessing/connection.py", line 614, in SocketClient
s.connect(address)
FileNotFoundError: [Errno 2] No such file or directory
来源:https://stackoverflow.com/questions/60795412/python-multiprocessing-error-forkawarelocal-object-has-no-attribute-connectio