Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Attempting to use showLabels script within a model...

$
0
0
I'm attempting to use a small script within my mxd (will later attach to a model) that will turn the labels on for a layer. My code is essentially straight from the Resource Center:

Code:

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\path\to\my.mxd")
for lyr in arcpy.mapping.ListLayers(mxd):
                if lyr.description == "Layer Name":
                                lyr.showLabels = True
del mxd
arcpy.RefreshTOC()
arcpy.RefreshActiveView()

I am running it with the mxd open from the python window. It looks like it is working because the map does refresh but the labels are not turning on.

Viewing all articles
Browse latest Browse all 2485

Trending Articles