I’m a new user of concurrent.futures.ProcessPoolExecutor. While trying a simple script, I faced a problem running the script in IDLE and through the windows cmd. Surprisingly, the script works using online interpreters like “https://www.programiz.com/”. The script is,
import concurrent.futures def func(a): return a**2 A = () with concurrent.futures.ProcessPoolExecutor(2) as executor: result = executor.map(func,range(10)) for r in result: A.append(r)
The Error is,
Traceback (most recent call last): File "C:UsersamirbOneDriveDesktopTEST.py", line 8, in <module> for r in result: File "D:PythonPython37libconcurrentfuturesprocess.py", line 483, in _chain_from_iterable_of_lists for element in iterable: File "D:PythonPython37libconcurrentfutures_base.py", line 598, in result_iterator yield fs.pop().result() File "D:PythonPython37libconcurrentfutures_base.py", line 435, in result return self.__get_result() File "D:PythonPython37libconcurrentfutures_base.py", line 384, in __get_result raise self._exception concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
I would appreciate it if someone could help me with the problem.