I suspect lyrList
is a collection of name-strings (e.g. lyrList = ["Layer1", "Layer2",]
). If this is the case, the string-type item doesn't work here if lyr.supports("LABELCLASSES"):
.
Alternatively, lyrList
is a collection layer Objects (e.g. lyrList = [<map layer u'SomeLayerName'>, <map layer u'SomeOtherLayerName'>]
, then redefining a lyr object with lyr = arcpy.mapping.ListLayers(mxd, lyr, df)[0]
doesn't work, as the "lyr" parameter should be a string (even if it worked, it's redundant).
Here is a snippet to ellaborate:
import arcpy
mxd = arcpy.mapping.MapDocument(r"CURRENT")### "CURRENT" or some path, e.g. r"C:\Project\Project.mxd"
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyrList = arcpy.mapping.ListLayers(mxd, "Build*", df)
print "Layer-List = ", lyrList ########## A simply list of things
print "Zeroth-Elm = ", lyrList[0] ######## the zeroth element of the list
print "Zeroth-Type = ", type(lyrList[0])### type of the zeroth element
print "---"
for lyr in lyrList:
print "Process '" + lyr.name + "' layer"
if lyr.supports("LABELCLASSES"):
### not needed ---> lyr = arcpy.mapping.ListLayers(mxd, lyr, df)[0]
lyr.showLabels = False
print "\tShow-Labels = " + str(lyr.showLabels)
arcpy.RefreshActiveView()
Shown here:

import arcpy
(unless your running it from the Python Window, which does that automatically).