python构造方法报错_解决python多线程报错:AttributeError: Can't pickle local object问题

报错信息:

Traceback (most recent call last):

File “D:/flaskProject/test.py”, line 35, in test

pool.apply(self.out, args=(i,))

File “Python37-32\lib\multiprocessing\pool.py", line 261, in apply

return self.apply_async(func, args, kwds).get()

File "\lib\multiprocessing\pool.py”, line 657, in get

raise self._value

File “\Python37-32\lib\multiprocessing\pool.py", line 431, in _handle_tasks

put(task)

File "\Python37-32\lib\multiprocessing\connection.py”, line 206, in send

self._send_bytes(_ForkingPickler.dumps(obj))

File “*\Python37-32\lib\multiprocessing\reduction.py”, line 51, in dumps

cls(buf, protocol).dump(obj)

TypeError: can't pickle _thread._local objects

原类的构造函数:

class threadtest:

def __init__(self, ipList, user, password):

self.ipList = ipList

<

你可能感兴趣的:(python构造方法报错)