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

Labeling works in 10, but not 10.1

$
0
0
I have a python script which at one point adds a new set of features, symbolizes, and labels them. In 10 everything works correctly, but when I run the script in 10.1, the labels are lost even though the symbology still applies correctly.

Here is the section of the code:

Code:

#select wells by buffer and create selection layer
arcpy.SelectLayerByLocation_management(welltypes, "HAVE_THEIR_CENTER_IN", Bufferresult)
arcpy.AddMessage("Selected Wells within Buffer Area")
arcpy.CopyFeatures_management(welltypes, wellresult)
layer2 = arcpy.mapping.Layer(wellresult)
arcpy.mapping.AddLayer(df, layer2)
updateLayer2 = arcpy.mapping.ListLayers(mxd, wellresult, df)[0]
arcpy.ApplySymbologyFromLayer_management(updateLayer2, wellstyle)
if layer2.supports("LABELCLASSES"):
    for lblclass in layer2.labelClasses:
        lblclass.showClassLabels = True
        lblclass.expression = '"%s" & [WELLNM] & "%s"' % ("<CLR red='36' green='93' blue='206'>", "</CLR>")
layer2.showLabels = True
arcpy.RefreshActiveView()
arcpy.RefreshTOC()
arcpy.AddMessage("Added Selected Wells to Map")

I've been researching but cannot find anything that would help sort this out. Has anyone else had a similar issue?

Viewing all articles
Browse latest Browse all 2485

Trending Articles