AnsweredAssumed Answered

Arcpy: replaceDataSource (from gdb to SDE w/ change in data source name)

Question asked by cbowles on Jul 31, 2015
Latest reply on Dec 23, 2015 by rastrauch

Hello all. We have a large task of replacing datasources for MANY feature classes and rasters (we received data from a consultant, and in order to place the data on the Client's enterprise server, all data has to conform to schema requirements). I have saved all of the data in their respective receptacles on the enterprise SDE environment. Now, I need to change the datasources within each of the mxds - this means every feature class in every mxd has to be relinked to the new name and location on the SDE. I want to do this with Python - naturally, otherwise task is beyond tedious.

So, I have my list of broken links, I have a table with name and location crosswalk for reference. I am not at all a Python guru and could really use some help in figuring out what the error below means (I feel like it has something to do with the enterprise SDE connection properties, but honestly don't know, especially since it is referencing my storage properties):

I have my broken list already, so am referencing that:

 

 

>>> for lyr in brokenlist:

...     if lyr.supports ("DATASOURCE"):

...         if lyr.dataSource == "Y:\00726_11_BDCP\data\DHCCP_ENG_Rev10b\DHCCP_Eng_Rev10b.gdb\Option_Point_Features":

...             lyr.replaceDataSource ("Y:\00726_11_BDCP\data\DHCCP_ENG_Rev10b\DHCCP_Eng_Rev10b.gdb\Option_Point_Features", "SDE_WORKSPACE", "C:\Users\cbowles\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\dhccp_eng.SDE.ER10b_Option_Point_Features")

... mapdoc.save ()

... del mapdoc

 

Runtime error

 

Traceback (most recent call last):

 

  File "<string>", line 5, in <module>

 

  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\utils.py", line 181, in fn_

 

    return fn(*args, **kw)

 

  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\_mapping.py", line 801, 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.

 

I appreciate all helpful comments.

Thanks,

Crystal

Outcomes