AnsweredAssumed Answered

importDocument does not work on some specific mxd. Manual import works fine in the app

Question asked by doesap on May 11, 2020

Just wondering if anyone has experienced similar issue. I have a script that imports each mxd in a folder to an empty ArcGIS Pro project, then use saveACopy to save to a new project file. The problem is: the script just does not work for 30% of my mxd files. The script is just stuck at the importDocument statement for those specific mxd, nothing happens, no error thrown.

 

For debugging, I got 2 print statements, one immediately before, one immediately after the importDocument:

 

...

print(mxd_path)

aprx.importDocument(mxd_path)

print('imported')

...

 

Whenever the script reaches an troublesome mxd, I get its path printed, then nothing happens (have left it just like that for an hour). When I open the ArcGIS Pro app and import the manual way, i.e. right-click on the mxd file in Catalog pane and select Import and Open, the same troublesome mxd is imported and opened in seconds.

 

For mxd that can be imported via the script, it's done in less than one second.

Outcomes