I have a simple script to test multiprocessing with arcpy, but the script hang indefinitely. The problem is with the import arcpy
statement that seems to be a problem in the child processes. Other multiprocessing script without import arcpy
are working correctly
import arcpy
import multiprocessing
import os, sys
multiprocessing.set_executable(os.path.join(sys.exec_prefix, 'python.exe'))
def testExists(data):
print data
return arcpy.Exists("foo.gdb")
if __name__ == '__main__':
data = ["foo.gdb", "bar.gdb"]
pool = multiprocessing.Pool(2)
result_arrays = pool.map(testExists, data)
print result_arrays
pool.close()
pool.join()
Any idea what can cause the problem?