I'm having problems with getting the mxd from the threaded function call, it's looks like it's an instance I cannot access.
My task is to loop through the mxd paths, open the mxd, loop the layers and re-point to designated datasources, loop the tables and re-point, save the mxd as another one.
Reason I'm trying to access the mxd created in the threaded process:
Why don't I put the whole process of opening the mxd and looping via datasources in the threaded call
So what am I trying to do
One of the (and simplest) approaches I've done is the following, which returns whatever you see in the screenshot capture:
from multiprocessing.pool import ThreadPool pool = ThreadPool(processes=1) mxd = pool.apply(openMapDocument, (mxd_path,))
def openMapDocument(mxd_path): mxd = None try: mxd = arcpy.mapping.MapDocument(mxd_path) return mxd except BaseException as ex: print 'Unable to open map document' raise