<?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: Add-in Combo box error in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292859#M22676</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pierre-Luc,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe the problem may be that you are trying to pass a feature class to the SelectLayerByAttribute function.&amp;nbsp; This requires a feature layer.&amp;nbsp; Try the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def onSelChange(self, selection): 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer = r"S:\Geomatique\Pierre-Luc\SPVM\Corridors_Scolaire\Carto.gdb\Ecoles"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(layer, "fLayer")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management("fLayer", "NEW_SELECTION", "DESC_LIEU = '" + selection + "'") 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 14:05:42 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2021-12-11T14:05:42Z</dc:date>
    <item>
      <title>Add-in Combo box error</title>
      <link>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292858#M22675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try to install the toolbar with the Combo box, I have this error :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;File "&amp;lt;string&amp;gt;", line 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;SyntaxError: can't assign to operator&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;Usually i'm able to resolve the syntax error but I have no clue for this one. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;Here my code : &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import pythonaddins

class LayersComboBoxClass(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for Python_Add-In_addin.combo_box (ComboBox)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items = []
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.editable = False
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.dropdownWidth = 'WWWWWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.width = 'WWWWWWWWWWWWWWWWWWWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onSelChange(self, selection):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer = r"S:\Geomatique\Pierre-Luc\SPVM\Corridors_Scolaire\Carto.gdb\Ecoles"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION", "DESC_LIEU = '" + selection + "'")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEditChange(self, text):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onFocus(self, focused):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.mxd = arcpy.mapping.MapDocument('current')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer = arcpy.mapping.ListLayers(self.mxd, "Ecoles")[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #self.items = []
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; values = [row[0] for row in arcpy.da.SearchCursor(layer, ["DESC_LIEU"])]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for uniqueVal in sorted(set(values)):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items.append(uniqueVal) 
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEnter(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def refresh(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:05:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292858#M22675</guid>
      <dc:creator>Pierre-LucBoivin</dc:creator>
      <dc:date>2021-12-11T14:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in Combo box error</title>
      <link>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292859#M22676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pierre-Luc,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe the problem may be that you are trying to pass a feature class to the SelectLayerByAttribute function.&amp;nbsp; This requires a feature layer.&amp;nbsp; Try the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def onSelChange(self, selection): 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer = r"S:\Geomatique\Pierre-Luc\SPVM\Corridors_Scolaire\Carto.gdb\Ecoles"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(layer, "fLayer")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management("fLayer", "NEW_SELECTION", "DESC_LIEU = '" + selection + "'") 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:05:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292859#M22676</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T14:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in Combo box error</title>
      <link>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292860#M22677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jake, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That was a good point for the feature layer but I still have the same error even after the modification. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 16:10:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292860#M22677</guid>
      <dc:creator>Pierre-LucBoivin</dc:creator>
      <dc:date>2015-02-12T16:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in Combo box error</title>
      <link>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292861#M22678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I get the same exact error with the default python script with no modifications when I add a combo box. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 13:47:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292861#M22678</guid>
      <dc:creator>BenBrosius</dc:creator>
      <dc:date>2015-03-09T13:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in Combo box error</title>
      <link>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292862#M22679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ben !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm always having this error displaying in the python windows on the first line when I loaded my toolbar but I'm able to execute my function anyways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 14:06:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292862#M22679</guid>
      <dc:creator>Pierre-LucBoivin</dc:creator>
      <dc:date>2015-03-09T14:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in Combo box error</title>
      <link>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292863#M22680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes will testing I can see that the toolbar still executes but my combo boxes and button all show up as missing so I can't really execute it the way I want to. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've actually found that if I create a simple toolbar with one button with the wizard and immediately build and install it with no code I get the same error and behavior. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 14:17:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292863#M22680</guid>
      <dc:creator>BenBrosius</dc:creator>
      <dc:date>2015-03-09T14:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in Combo box error</title>
      <link>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292864#M22681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a bit late but the problem is not in your code, it's in the filename. Your filename probably contains a dash/hyphen '-' or something else python interpreters don't like. Removing the dash/hyphen should solve your problem. You should also take a look at &lt;A href="https://www.python.org/dev/peps/pep-0008/#prescriptive-naming-conventions" title="https://www.python.org/dev/peps/pep-0008/#prescriptive-naming-conventions"&gt;PEP 8 -- Style Guide for Python Code | Python.org | Naming Conventions&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;SyntaxError&lt;/SPAN&gt;: 'Add-Ins_addin.py'&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #7ed529;"&gt;OK&lt;/SPAN&gt;: 'add_ins_addin.py'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 May 2016 08:34:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-in-combo-box-error/m-p/292864#M22681</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2016-05-25T08:34:03Z</dc:date>
    </item>
  </channel>
</rss>

