<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Labels in .lyr file in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271823#M21004</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Caleb,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply.&amp;nbsp; I had already tried that with this result&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 47, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: 'str' object has no attribute 'showLabels'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I could try to create a feature class, but thought that shouldn't be necessary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Glen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Feb 2013 18:14:17 GMT</pubDate>
    <dc:creator>GlenReid</dc:creator>
    <dc:date>2013-02-20T18:14:17Z</dc:date>
    <item>
      <title>Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271821#M21002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm converting an older GP task made using MB to Python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the original, data was saved to disk (.shp) and rendered with a layer file (.lyr).&amp;nbsp; Labels were displayed in the output.&amp;nbsp; I've updated the .lyr file to work with an in_memory layer (longer field names).&amp;nbsp; Here is the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy&amp;nbsp; arcpy.env.workspace = r"C:\gis-ags\src\gp"&amp;nbsp; # temporary date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"&amp;nbsp; # Script arguments #date_range = arcpy.GetParameterAsText(0) if date_range == '#' or not date_range: &amp;nbsp;&amp;nbsp;&amp;nbsp; date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"&amp;nbsp; # Local variables accum_table = "in_memory\\accumulation_table" stat_table = "in_memory\\stat_table" db_table = r"C:\gis-ags\src\gp\gisselect_cdo.sde\GIS.DAILYSNOW_GP_DATA"&amp;nbsp; # Table Select arcpy.TableSelect_analysis(db_table, accum_table, date_range)&amp;nbsp; # Summary Statistics arcpy.Statistics_analysis(accum_table, stat_table, "NAME FIRST;STATE FIRST;SNOWFALL SUM;LATITUDE FIRST;LONGITUDE FIRST", "COBAN")&amp;nbsp; # Spatial Reference sr = arcpy.SpatialReference() sr.factoryCode = 4269 sr.create()&amp;nbsp; # Make XY Event Layer lyr = "accum_xy_layer" arcpy.MakeXYEventLayer_management(stat_table, "FIRST_LONGITUDE", "FIRST_LATITUDE", lyr, sr)&amp;nbsp; # Symbology symbology_layer = "accumulation.lyr" arcpy.ApplySymbologyFromLayer_management(lyr, symbology_layer) &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For some reason, the labels are not getting displayed when I run in the ArcMap Python Window.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I missing something?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Glen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 17:34:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271821#M21002</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2013-02-20T17:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271822#M21003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think you should just need to add this after you apply the symbology:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
lyr.showLabels = True
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:16:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271822#M21003</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T13:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271823#M21004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Caleb,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply.&amp;nbsp; I had already tried that with this result&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 47, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: 'str' object has no attribute 'showLabels'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I could try to create a feature class, but thought that shouldn't be necessary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Glen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 18:14:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271823#M21004</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2013-02-20T18:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271824#M21005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Caleb,&lt;BR /&gt;&lt;BR /&gt;Thanks for the reply.&amp;nbsp; I had already tried that with this result&lt;BR /&gt;&lt;BR /&gt;Runtime error &lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 47, in &amp;lt;module&amp;gt;&lt;BR /&gt;AttributeError: 'str' object has no attribute 'showLabels'&lt;BR /&gt;&lt;BR /&gt;I could try to create a feature class, but thought that shouldn't be necessary.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Glen&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ahh, I see the problem here.&amp;nbsp; You will need to create a layer object before you can change the layer's properties.&amp;nbsp; Maybe try something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for lyr in arcpy.mapping.ListLayers('accum_xy_layer')[0]:
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.showLabels = True
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:16:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271824#M21005</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T13:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271825#M21006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;lyr you have set to text, so that's why you get the error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You used the lyr string to write your event layer - so you need a handle on the event layer object...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Caleb?&amp;nbsp; Ahhh, I see you posted again - yes, that should do it!&amp;nbsp; ...he's going to need the code snippet to get at the CURRENT mxd object (and dataframe likely) as well.&amp;nbsp; After re-reading his post, looks like Glen may want to 'overwrite' his layer file with the label settings from the temp layer in the map.&amp;nbsp; Better confirm that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 18:24:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271825#M21006</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-02-20T18:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271826#M21007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the replies.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have added the ListLayers code, so it now looks like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

arcpy.env.workspace = r"C:\gis-ags\src\gp"

# temporary
date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"

# Script arguments
#date_range = arcpy.GetParameterAsText(0)
if date_range == '#' or not date_range:
&amp;nbsp;&amp;nbsp;&amp;nbsp; date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"

# Local variables
accum_table = "in_memory\\accumulation_table"
stat_table = "in_memory\\stat_table"
db_table = r"C:\gis-ags\src\gp\gisselect_cdo.sde\GIS.DAILYSNOW_GP_DATA"

# Table Select
arcpy.TableSelect_analysis(db_table, accum_table, date_range)

# Summary Statistics
arcpy.Statistics_analysis(accum_table, stat_table, "NAME FIRST;STATE FIRST;SNOWFALL SUM;LATITUDE FIRST;LONGITUDE FIRST", "COBAN")

# Spatial Reference
sr = arcpy.SpatialReference()
sr.factoryCode = 4269
sr.create()

# Make XY Event Layer
lyr = "accum_xy_layer"
arcpy.MakeXYEventLayer_management(stat_table, "FIRST_LONGITUDE", "FIRST_LATITUDE", lyr, sr)

# Symbology
symbology_layer = "accumulation.lyr"
arcpy.ApplySymbologyFromLayer_management(lyr, symbology_layer)

for lyr in arcpy.mapping.ListLayers('accum_xy_layer')[0]:
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.showLabels = True

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I still get a runtime error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 47, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\utils.py", line 181, in fn_&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return fn(*args, **kw)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\mapping.py", line 1500, in ListLayers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = mixins.MapDocumentMixin(map_document_or_layer).listLayers(wildcard, data_frame)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\arcobjects\mixins.py", line 823, in listLayers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; layers = self.layers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\arcobjects\mixins.py", line 683, in layers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for frame in reversed(self.dataFrames):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\arcobjects\mixins.py", line 695, in dataFrames&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return map(convertArcObjectToPythonObject, self.pageLayout.dataFrames)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\arcobjects\mixins.py", line 679, in pageLayout&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return convertArcObjectToPythonObject(self._mxd._arc_object.pageLayout)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: 'str' object has no attribute '_arc_object'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I thought that since I previously specified labeling and saved to a .lyr file, that this would be taken care of in the ApplySymbologyFromLayer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Glen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:16:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271826#M21007</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2021-12-11T13:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271827#M21008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry, I did not look at the full code.&amp;nbsp; My example was for if you were accessing an mxd.&amp;nbsp; So are you just wanting to save this "accum_xy_layer" as a layer file?&amp;nbsp; It would be nice if the apply symbology worked for labels too.&amp;nbsp; I haven't been able to find anything that shows how to copy the label properties from another layer file.&amp;nbsp; There is a way to read label classes but I believe that is only for layers inside an mxd.&amp;nbsp; Hopefully someone else knows how to do this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 19:32:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271827#M21008</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-02-20T19:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271828#M21009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yeah, forget please what I said earlier about writing back to lyr file...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Evidently the same problem or 'disconnect' exists, meaning you do not have a handle to the layer...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The layer is in the map, I mean your event layer has been added?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If so try adding this (and I included Caleb's part of it) - I think that will correctly make the association through your currently operating mxd, correct me if I'm wrong please Caleb (I'm not sure):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Symbology
symbology_layer = "accumulation.lyr"
arcpy.ApplySymbologyFromLayer_management(lyr, symbology_layer)

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "")[0]

for lyr in arcpy.mapping.ListLayers(mxd, 'accum_xy_layer', df)[0]:
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.showLabels = True
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You may have to refresh the map yourself...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, forgot that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:16:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271828#M21009</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-11T13:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271829#M21010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The event layer does get added to the mxd, but only because my GP options are set so.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I added the code and get this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 50, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\arcobjects\mixins.py", line 361, in __iter__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.layers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: LayerObject: Get attribute layers does not exist&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 20:46:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271829#M21010</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2013-02-20T20:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271830#M21011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can no longer be certain what line 50 refers to - post your entire code again.&amp;nbsp; (you should no longer have a line 50)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is your lyr file where you have set your workspace?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am posting the full code I think you should have by now:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy&amp;nbsp; arcpy.env.workspace = r"C:\gis-ags\src\gp"&amp;nbsp; # temporary date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"&amp;nbsp; # Script arguments #date_range = arcpy.GetParameterAsText(0) if date_range == '#' or not date_range: &amp;nbsp;&amp;nbsp;&amp;nbsp; date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"&amp;nbsp; # Local variables accum_table = "in_memory\\accumulation_table" stat_table = "in_memory\\stat_table" db_table = r"C:\gis-ags\src\gp\gisselect_cdo.sde\GIS.DAILYSNOW_GP_DATA"&amp;nbsp; # Table Select arcpy.TableSelect_analysis(db_table, accum_table, date_range)&amp;nbsp; # Summary Statistics arcpy.Statistics_analysis(accum_table, stat_table, "NAME FIRST;STATE FIRST;SNOWFALL SUM;LATITUDE FIRST;LONGITUDE FIRST", "COBAN")&amp;nbsp; # Spatial Reference sr = arcpy.SpatialReference() sr.factoryCode = 4269 sr.create()&amp;nbsp; # Make XY Event Layer lyr = "accum_xy_layer" arcpy.MakeXYEventLayer_management(stat_table, "FIRST_LONGITUDE", "FIRST_LATITUDE", lyr, sr)&amp;nbsp; # Symbology symbology_layer = "accumulation.lyr"&amp;nbsp; mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "")[0]&amp;nbsp; lyr = arcpy.mapping.ListLayers(mxd, 'accum_xy_layer', df)[0] arcpy.ApplySymbologyFromLayer_management(lyr, symbology_layer) lyr.showLabels = True&amp;nbsp; arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&amp;nbsp; It could be you cannot use ApplySymbologyFromLayer to update labeling - this may be more about what you want, using labelClasses, as posted here by Craig McDade:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/threads/78032-Attempting-to-use-showLabels-script-within-a-model...#3" rel="nofollow" target="_blank"&gt;http://forums.arcgis.com/threads/78032-Attempting-to-use-showLabels-script-within-a-model...#3&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 21:32:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271830#M21011</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-02-20T21:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271831#M21012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, the accumulation.lyr file is in the workspace.&amp;nbsp; The code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

arcpy.env.workspace = r"C:\gis-ags\src\gp"

# temporary
date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"

# Script arguments
#date_range = arcpy.GetParameterAsText(0)
if date_range == '#' or not date_range:
&amp;nbsp;&amp;nbsp;&amp;nbsp; date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"

# Local variables
accum_table = "in_memory\\accumulation_table"
stat_table = "in_memory\\stat_table"
db_table = r"C:\gis-ags\src\gp\gisselect_cdo.sde\GIS.DAILYSNOW_GP_DATA"

# Table Select
arcpy.TableSelect_analysis(db_table, accum_table, date_range)

# Summary Statistics
arcpy.Statistics_analysis(accum_table, stat_table, "NAME FIRST;STATE FIRST;SNOWFALL SUM;LATITUDE FIRST;LONGITUDE FIRST", "COBAN")

# Spatial Reference
sr = arcpy.SpatialReference()
sr.factoryCode = 4269
sr.create()

# Make XY Event Layer
lyr = "accum_xy_layer"
arcpy.MakeXYEventLayer_management(stat_table, "FIRST_LONGITUDE", "FIRST_LATITUDE", lyr, sr)

# Symbology
symbology_layer = "accumulation.lyr"
arcpy.ApplySymbologyFromLayer_management(lyr, symbology_layer)

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "")[0]

for lyr in arcpy.mapping.ListLayers(mxd, 'accum_xy_layer', df)[0]:
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.showLabels = True

arcpy.RefreshActiveView()

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 50, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\arcobjects\mixins.py", line 361, in __iter__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.layers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: LayerObject: Get attribute layers does not exist&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll take a look at the referenced thread.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Glen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:17:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271831#M21012</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2021-12-11T13:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271832#M21013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The line that was throwing the error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for lyr in arcpy.mapping.ListLayers(mxd, 'accum_xy_layer', df)[0]:
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure why this is, I'll look into it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using Craig's code from the referenced thread fixed the error and displayed the labels:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

arcpy.env.workspace = r"C:\gis-ags\src\gp"

# temporary
date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"

# Script arguments
#date_range = arcpy.GetParameterAsText(0)
if date_range == '#' or not date_range:
&amp;nbsp;&amp;nbsp;&amp;nbsp; date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"

# Local variables
accum_table = "in_memory\\accumulation_table"
stat_table = "in_memory\\stat_table"
db_table = r"C:\gis-ags\src\gp\gisselect_cdo.sde\GIS.DAILYSNOW_GP_DATA"

# Table Select
arcpy.TableSelect_analysis(db_table, accum_table, date_range)

# Summary Statistics
arcpy.Statistics_analysis(accum_table, stat_table, "NAME FIRST;STATE FIRST;SNOWFALL SUM;LATITUDE FIRST;LONGITUDE FIRST", "COBAN")

# Spatial Reference
sr = arcpy.SpatialReference()
sr.factoryCode = 4269
sr.create()

# Make XY Event Layer
lyr = "accum_xy_layer"
arcpy.MakeXYEventLayer_management(stat_table, "FIRST_LONGITUDE", "FIRST_LATITUDE", lyr, sr)

# Symbology
symbology_layer = "accumulation.lyr"
arcpy.ApplySymbologyFromLayer_management(lyr, symbology_layer)

mxd = arcpy.mapping.MapDocument("CURRENT")
lyr = arcpy.mapping.ListLayers(mxd, "")[0]

if lyr.supports("LABELCLASSES"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for lblclass in lyr.labelClasses:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lblclass.showClassLabels = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; lblclass.expression = "[SUM_SNOWFALL]"
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.showLabels = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for all the help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Glen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:17:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271832#M21013</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2021-12-11T13:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271833#M21014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The line that was throwing the error:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for lyr in arcpy.mapping.ListLayers(mxd, 'accum_xy_layer', df)[0]:
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Not sure why this is, I'll look into it.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Glen,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm guessing that this probably doesn't work because you have two different things going on. When you select an item in the list by using the index [0], you are grabbing that one item out of the list. So what your code is saying is that you want to loop through the list, but also only grab index [0] in the list. Instead, I would do either one of the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for lyr in arcpy.mapping.ListLayers(mxd, 'accum_xy_layer', df):&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;lyr = arcpy.mapping.ListLayers(mxd, 'accum_xy_layer', df)[0]:&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:17:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271833#M21014</guid>
      <dc:creator>LucasDanzinger</dc:creator>
      <dc:date>2021-12-11T13:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Labels in .lyr file</title>
      <link>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271834#M21015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Lucus,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This does work, getting the layer and turning the default labels on: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for lyr in arcpy.mapping.ListLayers(mxd, 'accum_xy_layer', df):
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.showLabels = True

arcpy.RefreshActiveView()
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the hint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Glen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:17:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/labels-in-lyr-file/m-p/271834#M21015</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2021-12-11T13:17:10Z</dc:date>
    </item>
  </channel>
</rss>

