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

Labeling with python

$
0
0
Hello,

I am trying to give features labels with python code.

Here is the code I am using:

Code:

>>> import arcpy
... mxd = arcpy.mapping.MapDocument("CURRENT")
... layer = arcpy.mapping.ListLayers(mxd, "")[0]
... if layer.supports("LABELCLASSES"):
...    for lblclass in layer.labelClasses:
...              lblclass.showClassLabels = True
... lblclass.expression = "[type]"
... layer.showLabels = True
... arcpy.RefreshActiveView()
...

and I get this error:
Runtime error <type 'exceptions.NameError'>: name 'lblclass' is not defined

I thought this worked once, but not anymore..
Do I have to define "lblclass"??

If you could give me some help, I'd really appreciate it, thanks!

Viewing all articles
Browse latest Browse all 2485

Trending Articles