<?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: Problem with select by attributes in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-with-select-by-attributes/m-p/608006#M47453</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I've got problem with python to use select by attributes to my layer called "World Cities". I type this script:&lt;BR /&gt;&lt;BR /&gt;arcpy.SelectLayerByAttribute_management ("World Cities","NEW_SELECTION","CITY_NAME" = 'Abancay')&lt;BR /&gt;&lt;BR /&gt;and&amp;nbsp; I see : &lt;BR /&gt;Runtime error SyntaxError: keyword can't be an expression (&amp;lt;string&amp;gt;, line 1)&lt;BR /&gt;&lt;BR /&gt;When I'm trying this tool in arcgis not by python everything is ok, but in script I see this error. Please help!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The expression part of your script is not enclosed in quotes properly.&amp;nbsp; I believe "CITY_NAME" = 'Abancay' has to be "\"CITY_NAME\" = 'Abancay'" or '"CITY_NAME" = \'Abancay\''&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SelectLayerByAttribute_management ("World Cities","NEW_SELECTION","\"CITY_NAME\" = 'Abancay'")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;or:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SelectLayerByAttribute_management ("World Cities","NEW_SELECTION",'"CITY_NAME" = \'Abancay\'')&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 18 Jan 2014 20:34:00 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2014-01-18T20:34:00Z</dc:date>
    <item>
      <title>Problem with select by attributes</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-by-attributes/m-p/608004#M47451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've got problem with python to use select by attributes to my layer called "World Cities". I type this script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SelectLayerByAttribute_management ("World Cities","NEW_SELECTION","CITY_NAME" = 'Abancay')&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and&amp;nbsp; I see : &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error SyntaxError: keyword can't be an expression (&amp;lt;string&amp;gt;, line 1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I'm trying this tool in arcgis not by python everything is ok, but in script I see this error. Please help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jan 2014 17:48:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-by-attributes/m-p/608004#M47451</guid>
      <dc:creator>JoannaKIlian</dc:creator>
      <dc:date>2014-01-18T17:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select by attributes</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-by-attributes/m-p/608005#M47452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;it seems you answered your own question...do you want to share it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jan 2014 18:03:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-by-attributes/m-p/608005#M47452</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-01-18T18:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select by attributes</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-by-attributes/m-p/608006#M47453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I've got problem with python to use select by attributes to my layer called "World Cities". I type this script:&lt;BR /&gt;&lt;BR /&gt;arcpy.SelectLayerByAttribute_management ("World Cities","NEW_SELECTION","CITY_NAME" = 'Abancay')&lt;BR /&gt;&lt;BR /&gt;and&amp;nbsp; I see : &lt;BR /&gt;Runtime error SyntaxError: keyword can't be an expression (&amp;lt;string&amp;gt;, line 1)&lt;BR /&gt;&lt;BR /&gt;When I'm trying this tool in arcgis not by python everything is ok, but in script I see this error. Please help!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The expression part of your script is not enclosed in quotes properly.&amp;nbsp; I believe "CITY_NAME" = 'Abancay' has to be "\"CITY_NAME\" = 'Abancay'" or '"CITY_NAME" = \'Abancay\''&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SelectLayerByAttribute_management ("World Cities","NEW_SELECTION","\"CITY_NAME\" = 'Abancay'")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;or:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SelectLayerByAttribute_management ("World Cities","NEW_SELECTION",'"CITY_NAME" = \'Abancay\'')&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jan 2014 20:34:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-by-attributes/m-p/608006#M47453</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-01-18T20:34:00Z</dc:date>
    </item>
  </channel>
</rss>

