<?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: Running a for loop over an empty cursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/running-a-for-loop-over-an-empty-cursor/m-p/648787#M50491</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Check your field names held by your Fields list variable again. Print out rows.fields to make sure.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sure enough, programmer error, but that was a particularly obscure typo (which has existed undetected in my table for months).&amp;nbsp; I also would have thought that the updateCursor call would have been where it choked because that's where I first provide the invalid field name.&amp;nbsp; I guess then the default is to ignore fields it can't find.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On a different topic, do you know how to change the thread icon from a red 'Q' to a green 'A'?&amp;nbsp; Or better how to delete a thread entirely?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Mar 2013 12:15:00 GMT</pubDate>
    <dc:creator>StormwaterWater_Resources</dc:creator>
    <dc:date>2013-03-12T12:15:00Z</dc:date>
    <item>
      <title>Running a for loop over an empty cursor</title>
      <link>https://community.esri.com/t5/python-questions/running-a-for-loop-over-an-empty-cursor/m-p/648785#M50489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ArcStandard 10.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the following snippet in my script (with an intentionally empty cursor via where-clause):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;271&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.da.SearchCursor(fc, Fields, "1=2") 272&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(str(rows)) 273&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Before") 274&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows: 275&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("In")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run it I get this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Running script UpDownTest... &amp;lt;da.SearchCursor object at 0x1758E700&amp;gt; Before&amp;nbsp; Traceback (most recent call last): &amp;nbsp; File "C:\Projects\UpstreamDownstream\UpDownStorm.py", line 274, in &amp;lt;module&amp;gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows: RuntimeError: A column was specified that does not exist.&amp;nbsp; Failed to execute (UpDownTest).&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd thought before I started debugging that maybe I had a field name misspelled, but from printing the cursor I can see that an object is returned (though we know it's an empty cursor), and I can see I'm printing text after the cursor is created.&amp;nbsp; Thus it seems like the error really is in the for loop.&amp;nbsp; I can't figure out what's wrong here.&amp;nbsp; Shouldn't the for loop just be passed over?&amp;nbsp; Any suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 18:57:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/running-a-for-loop-over-an-empty-cursor/m-p/648785#M50489</guid>
      <dc:creator>StormwaterWater_Resources</dc:creator>
      <dc:date>2013-03-11T18:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Running a for loop over an empty cursor</title>
      <link>https://community.esri.com/t5/python-questions/running-a-for-loop-over-an-empty-cursor/m-p/648786#M50490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Check your field names held by your Fields list variable again. Print out rows.fields to make sure.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 19:18:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/running-a-for-loop-over-an-empty-cursor/m-p/648786#M50490</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-03-11T19:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Running a for loop over an empty cursor</title>
      <link>https://community.esri.com/t5/python-questions/running-a-for-loop-over-an-empty-cursor/m-p/648787#M50491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Check your field names held by your Fields list variable again. Print out rows.fields to make sure.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sure enough, programmer error, but that was a particularly obscure typo (which has existed undetected in my table for months).&amp;nbsp; I also would have thought that the updateCursor call would have been where it choked because that's where I first provide the invalid field name.&amp;nbsp; I guess then the default is to ignore fields it can't find.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On a different topic, do you know how to change the thread icon from a red 'Q' to a green 'A'?&amp;nbsp; Or better how to delete a thread entirely?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Mar 2013 12:15:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/running-a-for-loop-over-an-empty-cursor/m-p/648787#M50491</guid>
      <dc:creator>StormwaterWater_Resources</dc:creator>
      <dc:date>2013-03-12T12:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Marking threads answered; deleting threads</title>
      <link>https://community.esri.com/t5/python-questions/running-a-for-loop-over-an-empty-cursor/m-p/648788#M50492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;On a different topic, do you know how to change the thread icon from a red 'Q' to a green 'A'? &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This happens then you check a post as your answer by setting the big checkmark.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Or better how to delete a thread entirely?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Only the uber-moderators can do this. This thread is likely here forever.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2013 01:27:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/running-a-for-loop-over-an-empty-cursor/m-p/648788#M50492</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2013-03-13T01:27:09Z</dc:date>
    </item>
  </channel>
</rss>

