I am trying to implement the replaceDataSource method in some code and am having no luck. The code is:mxd = arcpy.mapping.MapDocument(fullpath)
DFList = arcpy.mapping.ListDataFrames(mxd)
for df in DFList:
lyrList = arcpy.mapping.ListLayers(mxd, "", df)
for lyr in lyrList:
if lyr.supports("DATASOURCE"):
#print lyr.dataSource
if lyr.dataSource == r"Database Connections\GIS_USER2PGIS.sde\SDE.Streets\SDE.LISStreetSegment":
lyr.replaceDataSource(r"Database Connections\Test_Carta_LIS.sde", "SDE_WORKSPACE", "Carta.LIS.StreetSegment")
lyr.name = "Carta.LIS.StreetSegment"
I am wondering if the SDE connections are just not working. Any thoughts?Michael