AnsweredAssumed Answered

ArcPy mapping - MapDocObject: Unable to save Attribute Error

Question asked by steveattt on May 7, 2013
Latest reply on Aug 5, 2013 by steveattt
I???m running a script to update the SDE Connection file path. This works fine. But I???m getting an output error ??? SOMETIMES!

The error occurs at the Save Map statement:

File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\", line 828, in saveACopy
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.

I have no Arcmap or ArcCat open.

Here???s my script:

import arcpy, os  # INPUT PARAMETERS Input_mxd = "G:\GIS\Weave\mxd\REBUILD\DataSrceTesting_2LblLayers_PptySbrbs.mxd" Output_mxd = "G:\GIS\Weave\mxd\REBUILD\newDataSource_EmptyOutput_3.mxd" Input_SDE = "Database Connections\Connection to vgeodb.sde" Output_SDE = "G:\GIS\Weave\Connections\Connection to"  mxd = arcpy.mapping.MapDocument(Input_mxd) for lyr in arcpy.mapping.ListLayers (mxd):  mxd.findAndReplaceWorkspacePaths(Input_SDE, Output_SDE)  print lyr  print lyr.dataSource mxd.saveACopy(Output_mxd)

The print statements are just so I can see whats going on - the code appears to update the connection paths as required.