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

Problem Setting Label Expression in Arcpy

$
0
0
I'm trying to set a label expression to a field ("StateWellNumber") in my table. I have the following code but I get an error message saying "name 'StateWellNumber' is not defined".

Any ideas?

Jon Mulder

Code:

LayerFileLocation = "H:\Documents\GIS\HydstraData"
LayerName = "WellPoints.lyr"
##Show labels for WellPoints.
arcpy.mapping.Layer(os.path.join(LayerFileLocation,LayerName)).supports("LABELCLASSES")
arcpy.mapping.Layer(os.path.join(LayerFileLocation,LayerName)).showLabels = True
arcpy.mapping.Layer(os.path.join(LayerFileLocation,LayerName)).labelClasses.expression =  [StateWellNumber]


Viewing all articles
Browse latest Browse all 2485