BUG
The ArcPy mapping module provides a number of methods that allow changes to a layer's workspace path or data source. These methods include:
MapDocument.findAndReplaceWorkspacePaths
MapDocument.replaceWorkspaces
Layer.findAndReplaceWorkspacePath
Layer.replaceDataSource
Table.findAndReplaceWorkspacePath
Table.replaceDataSource
This is a known limitation at ArcGIS 10 when using a local path to the SDE connection file.
For example, the following code does not update credentials:
Code:
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Data\Sde Map.mxd")
mxd.findAndReplaceWorkspacePaths(r"C:\Data\MyServer.sde",
r"C:\Data\MyServer Enter Credentials.sde")
mxd.saveACopy(r"C:\Data\Sde Map Output.mxd")
del mxd
Note:
Use bug NIM058538 when referencing this issue.
Code:
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Data\Sde Map.mxd")
mxd.findAndReplaceWorkspacePaths(r"C:\Data\MyServer.sde",
r"\\10FinalXp\Data\MyServer Enter Credentials.sde")
mxd.saveACopy(r"C:\Data\Sde Map Output.mxd")
del mxd
Get help from ArcGIS experts
Download the Esri Support App