<?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: Update Cursor infinite loop in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507877#M39906</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jake,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I could not figure out how to add an attachment to a private message.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So here is some sample data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jul 2012 17:48:47 GMT</pubDate>
    <dc:creator>SusieGreen</dc:creator>
    <dc:date>2012-07-03T17:48:47Z</dc:date>
    <item>
      <title>Update Cursor infinite loop</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507871#M39900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a python newbie and trying to update a field in a table based on a field in a feature class. The table already contains unique id's that have to match the id's in the feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What happens with the code below is that it goes in an infinite loop where it writes just the first value from the feature class in all the table rows.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# write Value to Table &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # search cursor &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; scurs = arcpy.SearchCursor(infc) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # update cursor &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ucurs = arcpy.UpdateCursor(tbl) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for scur in scurs: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newRow = scur.getValue("ID") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while newRow &amp;lt;&amp;gt; 0: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for ucur in ucurs: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ucur.Value = scur.getValue("Value") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # update row &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ucurs.updateRow(ucur)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2012 17:09:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507871#M39900</guid>
      <dc:creator>SusieGreen</dc:creator>
      <dc:date>2012-06-29T17:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Update Cursor infinite loop</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507872#M39901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Susie,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you trying to update a field within a table with a field within a feature class, where the table and feature class share a common ID?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that is correct, you could do this using data dictionaries.&amp;nbsp; The code below is going to update a field called 'Name' within the Airports_Info table from a field also called 'Name' in the Airports feature class.&amp;nbsp; The unique ID between the two is the field OBJECTID in the feature class, and ID in the table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;table = "Airports_Info"
fc = "Airports"

fcDict = {}

rows = arcpy.SearchCursor(fc, "", "", "", "OBJECTID A")
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcDict[row.OBJECTID] = row.Name
del rows, row

x = 0

rows = arcpy.UpdateCursor(table, "", "", "", "ID A")
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.ID == fcDict.keys()&lt;X&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Name = fcDict[row.ID]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Successfully updated row"
&amp;nbsp;&amp;nbsp;&amp;nbsp; x += 1
del rows, row&lt;/X&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:15:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507872#M39901</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T22:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Update Cursor infinite loop</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507873#M39902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jake,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thank you! That is exactly, what I am trying to do. I adjusted the code to fit your example and I get an error on line 11: IndexError: list index out of range.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcDict = {}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.SearchCursor(infc,"","","","ID")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcDict[row.ID] = row.Value
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del rows, row
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.UpdateCursor(tbl,"","","","ID")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.ID == fcDict.keys()&lt;X&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Value = fcDict[row.ID]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del rows, row&lt;/X&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:15:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507873#M39902</guid>
      <dc:creator>SusieGreen</dc:creator>
      <dc:date>2021-12-11T22:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Update Cursor infinite loop</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507874#M39903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try changing your Search and Update cursors to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
rows = arcpy.SearchCursor(infc,"","","","ID A")

rows = arcpy.UpdateCursor(tbl,"","","","ID A")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The 'A' after ID will sort the fields in Ascending order.&amp;nbsp; Let me know if you receive the same error.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:15:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507874#M39903</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T22:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Update Cursor infinite loop</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507875#M39904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jake,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;unfortunately I receive the same error. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I replaced the x in the following line with the index of the actual length of my list, like this: if row.ID == fcDict.keys()[10]:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That updated my 11 rows just fine. The problem is though that the length of that list varies. Do you know how to fix that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2012 16:58:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507875#M39904</guid>
      <dc:creator>SusieGreen</dc:creator>
      <dc:date>2012-07-03T16:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Update Cursor infinite loop</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507876#M39905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Could you send me a subset of the data?&amp;nbsp; You can send me a private message with zipped attachment by clicking on my user name &amp;gt; Private Message.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2012 17:18:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507876#M39905</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-07-03T17:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Update Cursor infinite loop</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507877#M39906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jake,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I could not figure out how to add an attachment to a private message.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So here is some sample data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2012 17:48:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507877#M39906</guid>
      <dc:creator>SusieGreen</dc:creator>
      <dc:date>2012-07-03T17:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Update Cursor infinite loop</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507878#M39907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The problem before was that the dictionary was not sorted correctly.&amp;nbsp; You can do this one of two ways.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; Using an a data dictionary with an updateCursor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;table = "Basins.dbf" fc = "Watersheds.shp"&amp;nbsp; fcDict = {}&amp;nbsp; rows = arcpy.SearchCursor(fc, "", "", "", "ID A") for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp; fcDict[row.ID] = row.Value del rows, row&amp;nbsp; x = 0&amp;nbsp; rows = arcpy.UpdateCursor(table, "", "", "", "ID A") for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp; if row.ID == sorted(fcDict)&lt;X&gt;: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Value = fcDict[row.ID] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Successfully updated row" &amp;nbsp;&amp;nbsp;&amp;nbsp; x += 1 del rows, row&lt;/X&gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&amp;nbsp; Create a Join and then calculate values using the Field Calculator:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;table = "Basins.dbf" fc = "Watersheds.shp"&amp;nbsp; arcpy.MakeTableView_management(table, "Basins_view") arcpy.AddJoin_management("Basins_view", "ID", fc, "ID")&amp;nbsp; arcpy.CalculateField_management("Basins_view", "basins.Value", "[watersheds.Value]")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2012 18:44:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507878#M39907</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-07-03T18:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Update Cursor infinite loop</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507879#M39908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you, Jake!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now it works perfectly. Much appreciated &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2012 18:51:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507879#M39908</guid>
      <dc:creator>SusieGreen</dc:creator>
      <dc:date>2012-07-03T18:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Update Cursor infinite loop</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507880#M39909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, I am a python novice and am having similar trouble with data dictionaries and cursors. I have a feature class that I added a new field to (Geology_Class). I want to update the new field with the items from my dictionary. The keys in the dictionary are PTYPE and I want the new field to contain the values. I created a search cursor so that it would loop through the existing PTYPE field (there are about 60 I just provided a snippet) in my feature class. I then added the update cursor so that it would search the PTYPE and add it to the new Geology_Class field. When I run the script I get an error "Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"File "C:\Users\Users\Desktop\GeoDis.py", line 42, in &amp;lt;module&amp;gt; row[2] = dictionary(row[1]) TypeError: 'dict' object is not callable." or I get "does not support indexing".&amp;nbsp; Upon reading other forums is looks like I am trying to call a function when in reality it's not? I want to try and avoid pointing to a separate table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help you can offer is greatly appreciated. Thank you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using ArcGIS 10.0&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy
from arcpy import env
arcpy.env.overwriteOutput = True

dictionary = {'C':'INSERT1','Ca':'Coarse-Competent','D':'INSERT2' ,'E':'Fine-Competent','Ec':'Coarse-Competent',
'E-Ep':'INSERT3','Ep':'Coarse-Competent','gb':'Crystalline','gr':'INSERT4','grCz':'INSERT5','grCz?':'INSERT6','gr-m':'Crystalline','grMz':'Crystalline', 'grMz?':'Crystalline'}


Input_Geology_Feature_Class = arcpy.GetParameterAsText(0)

searchCursor = arcpy.SearchCursor(Input_Geology_Feature_Class,"","","PTYPE","")



arcpy.AddMessage("Adding Geology Class Field...")
arcpy.AddField_management(Input_Geology_Feature_Class, "Geology_Class","TEXT")



arcpy.AddMessage("Populating Geology Class Field, Please Wait...")
geology = arcpy.UpdateCursor(Input_Geology_Feature_Class,["PTYPE", "Geology_Class"])

for row in geology:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = dictionary(row[1])
&amp;nbsp;&amp;nbsp;&amp;nbsp; geology.updateRow([row])
del row, geology
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:15:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507880#M39909</guid>
      <dc:creator>PapantzinCid</dc:creator>
      <dc:date>2021-12-11T22:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Update Cursor infinite loop</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507881#M39910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was able to figure it out.&amp;nbsp; Thank you for taking the time to read.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem was my update cursor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;geology = arcpy.UpdateCursor(Input_Geology_Feature_Class,["PTYPE", "Geology_Class"])&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for updateRow in geology:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if updateRow.PTYPE in dictionary:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow.Geology_Class = dictionary[updateRow.PTYPE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geology.updateRow(row)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del updateRow, geology&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Mar 2013 05:28:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-infinite-loop/m-p/507881#M39910</guid>
      <dc:creator>PapantzinCid</dc:creator>
      <dc:date>2013-03-22T05:28:03Z</dc:date>
    </item>
  </channel>
</rss>

