Bjorn,Your code looks a little more complicated than it needs to be, however it ran OK when I simply copied what you had (and changed the contents of project() to some generic math).When I tested it with actual ProjectRaster I realised that you don�??t specify an output location, and if you are using pool.map() you can only pass a single argument to the function. Consequently, I had to change the code around to allow two things (input and output paths) to be passed to project()�?� To do this I used the job server notation that was in my multiprocessing post.I also took out the unnecessary function main() that you had (from copying the ESRI example, I presume) �?? scripted things will run just fine from within the if __name__ == �??__main__�??: statement. This code works perfectly for me (tested with 5 reasonably large rasters):import os, multiprocessing, arcpy
def project(rasterin, rasterout):
arcpy.ProjectRaster_management(rasterin, rasterout,#�?�
# just return something; will print once done
return �??converted: %s and made output: %s�?? % (rasterin,rasterout)
if __name__ == �??__main__�??:
workspace = r�??d:\Temp\dems�??
arcpy.env.workspace = workspace
fcs = arcpy.ListRasters(�??*�??)
pool = multiprocessing.Pool()
jobs = []
# iterate through features, add input and output paths
for fc in fcs:
rIn = os.path.join(workspace, fc)
rOut = os.path.join(r�??d:\Temp\demsOut�??, fc)
jobs.append(pool.apply_async(project, (rIn, rOut)))
for job in jobs:
print job.get()