fork download
  1. from multiprocessing import Pool
  2.  
  3.  
  4. def run(script_name):
  5. with open(script_name, 'r', encoding='utf_8') as f:
  6. return exec(f.read())
  7.  
  8.  
  9. if __name__ == '__main__':
  10. with Pool(3) as p:
  11. print(p.map(run, ['1.py', '2.py', '3.py']))
  12.  
Runtime error #stdin #stdout #stderr 0.2s 24960KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "./prog.py", line 5, in run
FileNotFoundError: [Errno 2] No such file or directory: '2.py'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./prog.py", line 11, in <module>
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 268, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 657, in get
    raise self._value
FileNotFoundError: [Errno 2] No such file or directory: '2.py'