gismarty

arcpy.mapping.UpdateLayer doesn't bring in labeling

Discussion created by gismarty on Jul 22, 2012
Latest reply on Aug 6, 2012 by jbarrette-esristaff
Hi friends,

It's me again :)

I am having some difficulty getting arcpy.mapping.UpdateLayer to actually bring in labeling. It brings in everything else fine from the reference layer (legend colours etc...) except once it is in my map, the layer does not have the necessary labeling. If I go in and check the checkbox and fill in the expression myself, it works fine. Of course, when I open the reference .lyr file itself, it does indeed have the checkbox ticked and the expression is present.

Anyone know why this happens?

I've tried using the following bits of code as well, but they do nothing either :(


    
if landtypelayer.supports("LABELCLASSES"):
        arcpy.AddMessage("supports labelclass!")
        landtypelayer.showLabels = True
        for lblclass in landtypelayer.labelClasses:
            arcpy.AddMessage("in labelclass forloooooooooooooop!")
            lblclass.className = "Land Types"
            lblclass.expression = "[GLM_CODE] & vbnewline & [GLM_PC]"
            lblclass.showClassLabels = True


Any ideas?

Thanks!

Outcomes