I'm very new to ArcPy and programming in general. I'm trying to use UpdateLayer to add hatching to a selected layer from a template layer I've created.
The script runs (no errors), but it doesn't update my selected layer:
import arcpy mxd = arcpy.mapping.MapDocument('CURRENT') df = arcpy.mapping.ListDataFrames(mxd, 'Stationing') sourceLayer = arcpy.mapping.Layer(r'H:\Python\Data\Template.lyr') updateLayer = arcpy.mapping.ListLayers(mxd, 'IAmRoute.lyr', df) arcpy.mapping.UpdateLayer(df, updateLayer, sourceLayer, False) mxd.saveACopy(r'H:\Python\Stationing2.mxd') del mxd, sourceLayer
Am using ArcGIS Desktop 10.5.1.
When I save a copy of the mxd, I end up with two layers named Template. One appears to be the original Template layer, the second appears to be my original IAmRoute layer with its original properties.
Running from Arcmap w/mxd Stationing open.
edit: changed MapDocument to 'CURRENT'