Sunday 7 April 2019

arcpy - Converting .mxd files to be compatible with earlier version?



I am running ArcMap 10.1. I need to open a .mxd that saved using 10.3, however, I do not have access to 10.3. I tried to execute a python tool that was created using Esri's How To: Save map documents in ArcGIS 10.x to previous version of ArcGIS in batch.


The error that I got was:



Traceback (most recent call last): File "D:\GIS_data\scripts\mxd_rollback.py", line 14, in mxd.saveACopy(outloc + os.sep + base, version) File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\utils.py", line 181, in fn_ return fn(*args, **kw) File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy_mapping.py", line 826, in saveACopy self._arc_object.saveACopy(file_name, version) AttributeError: MapDocObject: Unable to save. Check to make sure you have write access to the specified file and that there is enough space on the storage device to hold your document.


Failed to execute (ConvertMXDs).



Following is a copy of the script that I executed:


import arcpy, sys, os, string 


mxdList = string.split(arcpy.GetParameterAsText(0), ";")
outloc = arcpy.GetParameterAsText(1)
version = arcpy.GetParameterAsText(2)

suffix = "_"+ version.replace(".", "")

for item in mxdList:
item = item.strip('\'')
mxd = arcpy.mapping.MapDocument(item)

base = os.path.basename(item)
base = os.path.splitext(base)[0] + suffix + os.path.splitext(base)[1]
mxd.saveACopy(outloc + os.sep + base, version)
arcpy.AddMessage(os.path.basename(item) + " has been converted")


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...