AnsweredAssumed Answered

arcpy.mapping.UpdateLayers isn't updating...

Question asked by jsommerville on Dec 10, 2018
Latest reply on Dec 10, 2018 by jsommerville

I'm trying to create a script that updates layer symbology in other mxds by asking for mxds and asking for the source layer. The script is supposed to iterate through each mxd selected and search for layer names that match the source layer. No error is given and it prints my message at the end but when looking at the mxd that was supposed to be updated, the symbol doesn't change. 

 

 

import arcpy, string, os

mxdSelection = arcpy.GetParameterAsText(0)
sourceLyr = arcpy.GetParameter(1)
mxdString = mxdSelection.split(";")
 for each in mxdString:
 mxd = arcpy.mapping.MapDocument(each)
    for df in arcpy.mapping.ListDataFrames(mxd):
       for lyr in arcpy.mapping.ListLayers(mxd, "", df):
       if lyr.name == sourceLyr.name:
         arcpy.mapping.UpdateLayer(df, lyr, sourceLyr, True)
         arcpy.AddMessage(lyr.name + " under the " + df.name + " data frame has been updated.")

 

 

This is what appears in the "successful" message:

 

 

When I open the "updated" mxd, symbols are the same.

Thanks for reading and any advice given!

Outcomes