I'm running a script (ArcMap 10.5) that loops through a list of mxds, and saves a copy with a new name showing the year and quarter. This works for all mxds, unless they have an annotation feature class in them.
When there is an annotation featureclass, I get this 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.
The script is very simple.
mapList = [r"C:\Projects\Figure 1.mxd", r"Z:\Projects\Figure 2.mxd"] #make updates for mapDoc in mapList: mxd = arcpy.mapping.MapDocument(mapDoc) #generate year and quarter some code... Q_Y = "Q" + quarter + " " + year #generate names/paths bn = os.path.basename(mapDoc).replace(".mxd", "") + " " + Q_Y #path fullPathMXD = os.path.join(C:\Projects, bn + ".mxd") #save as new map doc mxd.saveACopy(fullPathMXD) #create new map doc object to export EPS from mxd2 = arcpy.mapping.MapDocument(fullPathMXD) #update title/eps name mxd2.title = .... #export to eps arcpy.mapping.ExportToEPS(mxd2, locationPDF + "\\" + bn + ".eps", "Page_Layout",640,480,200,"BEST","RGB",3, "ADAPTIVE","RASTERIZE_BITMAP",True,False)
Has anyone encountered this problem, or can anyone tell me what's going on here?
The mxds that do not throw this error do not have annotation featureclasses, but do have featureclasses that live in the same .gdb.
I used disutils to copy the mxd to a new location, under a different name, and this solved the first error. However, it now throws this error:
AttributeError: 'NoneType' object has no attribute 'exportToEPS'
Again, this only happens when there are annotation layers in the map. Without them, the original, and the "disutils", version work as expected.