<?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 Expected Field not found or retrieved - Python SelectLayerByLocation in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/expected-field-not-found-or-retrieved-python/m-p/643367#M50183</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to complete a select by layer on a layer I just made and keep getting an error code in PythonWin that "An expected Field was not found or could not be retrieved properly." It repeats this seveal times and references the dataset at as well in some of the lines and finishes with an error for SelectLayerbyLocation.&amp;nbsp; This is for a class I'm taking... I just can't seem to figure out what is causing this error code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd appreciate any input or direction to reading materials to figure out what I'm doing wrong. Below is the errro code and I've attached my .py.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; made feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"NAME" ="North Central"&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 "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 312, in RunScript&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\WCGIS\GEOG485\Lesson3\simplifiedstepback.py", line 29, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management("GraffitiIncidentsLayer", "CONTAINED_BY", "CurrentPatrolZoneLayer")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 4381, in SelectLayerByLocation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An expected Field was not found or could not be retrieved properly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An expected Field was not found or could not be retrieved properly. [PatrolZones]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An expected Field was not found or could not be retrieved properly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An expected Field was not found or could not be retrieved properly. [PatrolZones]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (SelectLayerByLocation).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Nov 2011 04:17:21 GMT</pubDate>
    <dc:creator>KendraRodgers</dc:creator>
    <dc:date>2011-11-14T04:17:21Z</dc:date>
    <item>
      <title>Expected Field not found or retrieved - Python SelectLayerByLocation</title>
      <link>https://community.esri.com/t5/python-questions/expected-field-not-found-or-retrieved-python/m-p/643367#M50183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to complete a select by layer on a layer I just made and keep getting an error code in PythonWin that "An expected Field was not found or could not be retrieved properly." It repeats this seveal times and references the dataset at as well in some of the lines and finishes with an error for SelectLayerbyLocation.&amp;nbsp; This is for a class I'm taking... I just can't seem to figure out what is causing this error code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd appreciate any input or direction to reading materials to figure out what I'm doing wrong. Below is the errro code and I've attached my .py.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; made feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"NAME" ="North Central"&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 "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 312, in RunScript&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\WCGIS\GEOG485\Lesson3\simplifiedstepback.py", line 29, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management("GraffitiIncidentsLayer", "CONTAINED_BY", "CurrentPatrolZoneLayer")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 4381, in SelectLayerByLocation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An expected Field was not found or could not be retrieved properly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An expected Field was not found or could not be retrieved properly. [PatrolZones]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An expected Field was not found or could not be retrieved properly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An expected Field was not found or could not be retrieved properly. [PatrolZones]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (SelectLayerByLocation).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Nov 2011 04:17:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/expected-field-not-found-or-retrieved-python/m-p/643367#M50183</guid>
      <dc:creator>KendraRodgers</dc:creator>
      <dc:date>2011-11-14T04:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Expected Field not found or retrieved - Python SelectLayerByLocation</title>
      <link>https://community.esri.com/t5/python-questions/expected-field-not-found-or-retrieved-python/m-p/643368#M50184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi SpringsGirl,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe your queryString is incorrect.&amp;nbsp; You will want the query to be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"NAME" = &lt;/SPAN&gt;&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;SPAN&gt;North Central&lt;/SPAN&gt;&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;SPAN&gt; instead of "NAME" = &lt;/SPAN&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;SPAN&gt;North Central&lt;/SPAN&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try changing your queryString to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;queryString = '"' + nameField + '" =' + "'" + currentPatrolZone + "'"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Nov 2011 09:59:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/expected-field-not-found-or-retrieved-python/m-p/643368#M50184</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-11-14T09:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Expected Field not found or retrieved - Python SelectLayerByLocation</title>
      <link>https://community.esri.com/t5/python-questions/expected-field-not-found-or-retrieved-python/m-p/643369#M50185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Jake!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That is exactly what I had wrong.&amp;nbsp; Although I did that intentionally... I fear I do no yet completely understand using quotes. In my mind it went something like this. I was using a field name equal to a string so it would look like this intially&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"Field_Name" = 'str'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and I didn't think I could have " " = ' '&amp;nbsp;&amp;nbsp; so I made sure to get the other side into " " &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"Field_Name" = "Name" &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this have anything to do with the fact that my code was referencing variables for strings and not strings themselves??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for your speedy response!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 00:19:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/expected-field-not-found-or-retrieved-python/m-p/643369#M50185</guid>
      <dc:creator>KendraRodgers</dc:creator>
      <dc:date>2011-11-15T00:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Expected Field not found or retrieved - Python SelectLayerByLocation</title>
      <link>https://community.esri.com/t5/python-questions/expected-field-not-found-or-retrieved-python/m-p/643370#M50186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Kendra,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I too get confused with syntax for queries, especially for fields.&amp;nbsp; You can refer to the following link for help with syntax:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s500000033000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s500000033000000.htm&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 15:42:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/expected-field-not-found-or-retrieved-python/m-p/643370#M50186</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-11-15T15:42:26Z</dc:date>
    </item>
  </channel>
</rss>

