I want to utilize multiprocessing within my arcpy scripts but my first test has run into a problem which I don't understand. I'm running the script in the python window:
import arcpy
from multiprocessing import Pool
def f(x):
return x*x
pool = Pool(processes=4)
print pool.map(f,[1,2,3,4])
As soon as I assign the processes, ArcMap open four new instances and the script does not print the values of x as expected (the above code is from an example I found). The new instances of ArcMap initialize but then close with the following error:
What am I doing wrong? Is there a setting/patch I've ignored? I'm using ArcMap Desktop 10.0 SP5 build 4400 and I have also tried the code on 10.3.1.4959.