AnsweredAssumed Answered

Is there something wrong with lyr.replaceDataSource ?

Question asked by euloki on Mar 12, 2018
Latest reply on Mar 16, 2018 by euloki

I have been racking my brain trying to figure out why I can't get this simple code to execute properly.  I am trying to replace Datasources for numerous layers in numerous mxd's.  I really don't want to do this manually!  Essentially, a new file gdb has been created in a new folder with renamed feature classes.  Feature class names were changed to simplify other geoprocessing scripts. Now I need to re-link the datasources to the new datasets.


 I have a working code:  it walks through a directory, it lists mxd's by file name, it finds layers and prints their names and finally saves the mxd.  there are no bugs; however, when I open the mxd, the datasource has not changed.  The script runs through the lyr.replaceDataSource but does not actually replace the datasource.  I have used the validate {FALSE} parameter and still no luck!  I am not a whiz when it comes to python, but I thought this was a pretty straight forward script. 

Does anyone see what I am doing wrong?  What am I overlooking?