Select to view content in your preferred language

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

1034
0
06-07-2018 04:53 AM
JoseSanchez
Frequent Contributor

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.
>>>

0 Replies