Facing problem running multiprocessing in python when I run the script in cmd but runs with python program

I’m able to run a python script which is using multiprocessing module (also tried with concurrent.futures module but the same result) in my windows 10 machine, python 3.8.4 environment from command line.

The same script if I try to run in command line on another machine with Win 7, python 3.7.4 environment, it stops with error "Python has stopped working. Windows is checking for a solution to the problem"

below is the part of the code where it has issue:

pool = multiprocessing.Pool(processes=4)
function_list=partial(function, arguments)
pool.map(function_list, argument_list)

it stops at the pool.map execution.

Also tried with concurrent.futures in place of multiprocessing, but same result.

But if I run the same script opening with Python program installed in the machine, it runs fine.

Also if I don’t use multiprocessing and run the script only for one target (I’m using multiprocessing to copy some content from source to target in parallel), it works fine.

Source: Python-3x Questions

LEAVE A COMMENT