I'm using a python script to create an empty group layer in the current map document, add some layers to this group and update their symbology from an existing .lyr file.
I also want to to turn on these layers' labels using
layer.showLabels = True and it works fine for normal layers, but for some reason it doesn't work on layers inside a group layer. However, when I manually drag these layers outside of the group, the labels are suddenly displayed, and they are still displayed when I drag the layers back into the group.
Does anyone has an idea why does it happen and how can I programmatically display the labels even for layers inside a group?
Here is the relevant part (of a simplified version) of my ode:
mxd = arcpy.mapping.MapDocument("Current") df = arcpy.mapping.ListDataFrames(mxd) groupLyr = arcpy.mapping.Layer(r'C:\Path\to\Group.lyr') # this is an empty group lyr file arcpy.mapping.AddLayer(df,groupLyr) currentGroup = arcpy.mapping.ListLayers(mxd,"Group") source_fc = arcpy.mapping.Layer(r'C:\Path\to\my.gdb\feature_class') arcpy.mapping.AddLayerToGroup(df, currentGroup, source_fc, "BOTTOM") lyr = arcpy.mapping.ListLayers(mxd,"[my layer's name]") lyr.showLabels = True # this line doesn't raise an error, but it does not turns the labels on