1. 程式人生 > 其它 >python multiprocessing多程序 cannot pickle '_io.TextIOWrapper' object

python multiprocessing多程序 cannot pickle '_io.TextIOWrapper' object

Python 3.9.6 在windows下使用multiprocessing多程序報如下錯誤,但linux下正常

Traceback (most recent call last):
  File "D:\Studio\python\New\autoTest\cases\Zd\commDaping.py", line 324, in testDapingLianHuaShiYeOK
    self.dapingLianHuaShiYeOK(driver, paramsIn, checkPoint)
  File "D:\Studio\python\New\autoTest\cases\Zd\dapingLianHuaShiYe.py
", line 40, in dapingLianHuaShiYeOK t1.start() File "D:\ProgramFiles\Python\Python39\lib\multiprocessing\process.py", line 121, in start self._popen = self._Popen(self) File "D:\ProgramFiles\Python\Python39\lib\multiprocessing\context.py", line 224, in _Popen return _default_context.get_context().Process._Popen(process_obj) File
"D:\ProgramFiles\Python\Python39\lib\multiprocessing\context.py", line 327, in _Popen return Popen(process_obj) File "D:\ProgramFiles\Python\Python39\lib\multiprocessing\popen_spawn_win32.py", line 93, in __init__ reduction.dump(process_obj, to_child) File "D:\ProgramFiles\Python\Python39\lib\multiprocessing\reduction.py
", line 60, in dump ForkingPickler(file, protocol).dump(obj) TypeError: cannot pickle '_io.TextIOWrapper' object