osoong

saveACopy error "Unable to save"

Discussion created by osoong on Nov 8, 2013
Latest reply on Nov 11, 2013 by osoong
I've been using saveACopy in python and have been encountering strange errors as I develop my mapping/geoprocessing scripts.  To demonstrate the problem, I saved a blank mxd to C:/tmp/test.mxd.  It appears to be important to run the examples in fresh python sessions each time.  This code:

import arcpy
mxd = arcpy.mapping.MapDocument("C:/tmp/test.mxd")
mxd.saveACopy("C:/tmp/test3.mxd")
mxd.saveACopy("C:/tmp/test3.mxd")
mxd.saveACopy("C:/tmp/test2.mxd")
mxd.saveACopy("C:/tmp/test3.mxd")


is able to save test3.mxd the first and third times but not the second time, when if fails with error:

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.


Obviously, it's not a problem with overwriting the previous output, it's not a permissions issue, and it's not a storage space issue.

Separately, this code (in a fresh python session) also fails with the same error:

import arcpy
mxd = arcpy.mapping.MapDocument("C:/tmp/test.mxd")
mxd.saveACopy("C:/tmp/test2.mxd")


However, the same saveACopy code (in fresh python sessions each time) succeeds with C:/tmp/test3.mxd (as we've already seen), C:/tmp/tmp/test2.mxd, W:/test2.mxd, and W:/tmp/test2.mxd.

Outcomes