import arcpy
... mxd = arcpy.mapping.MapDocument("CURRENT")
... for lyr in arcpy.mapping.ListLayers(mxd, "TestFile_LineToPoints13_Prod"):
... if lyr.supports("LABELCLASSES"):
... for lblclass in lyr.labelClasses:
... lblclass.expression = " [OBJECTID]"
... if lblClass.showClassLabels:
... print " Class Name: " + lblClass.className
... print " Expression: " + lblClass.expression
... mxd.save()
... del mxd
...
Prints:
Class Name: Default
Expression: [Shape_Length]
The label for that layer is even set at ObjectID and is currently showing the labels... Why does it keep responding Shape_Length?