AnsweredAssumed Answered

IOError: MapDocObject: Unable to save.  Check to make sure you have write access

Question asked by jsn on Jun 7, 2018

Hello everyone,

 

I am running a very simple program to change datasources in a mxd layers in ArcMap 10.4.1.

 

I have write access to the folder.

 

Source Code:

 

# Parent directory to MXDs.  Script will iterate through Child directories
arcpy.env.workspace  = r"C:\Workspace\NB\Oracle"

# New Enterprise Geodatabase

newDataSource = r"C:\GISData_SQL.sde"

arcpy.env.overwriteOutput = True

for (path, dirs, files) in os.walk(arcpy.env.workspace):
    for file in files:
        print file
        if ".mxd" in file.lower():
            mxdfile = os.path.join(path, file)
            print(mxdfile + " is being processed")
            mxd = arcpy.mapping.MapDocument(mxdfile)
 
            mxd.save()       **************************  ERROR WHEN SAVING

 

 

 

Error message:

 

Traceback (most recent call last):
  File "C:\Workspace\MigrationArcSDEOracleToSQL104\Projects\Change SDE Data Source.py", line 53, in <module>
    mxd.save()
  File "C:\Program Files\ArcGIS\Server\ArcPy\arcpy\utils.py", line 182, in fn_
    return fn(*args, **kw)
  File "C:\Program Files\ArcGIS\Server\ArcPy\arcpy\_mapping.py", line 850, in save
    return convertArcObjectToPythonObject(self._arc_object.save(*gp_fixargs((), True)))
IOError: 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.
>>>

Outcomes