AnsweredAssumed Answered

Update Cursor infinite loop

Question asked by susieg on Jun 29, 2012
Latest reply on Mar 21, 2013 by Papantzin
Hello everyone,

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.
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.
Any help would be greatly appreciated.

# write Value to Table         # search cursor         scurs = arcpy.SearchCursor(infc)         # update cursor         ucurs = arcpy.UpdateCursor(tbl)         for scur in scurs:             newRow = scur.getValue("ID")             while newRow <> 0:                 for ucur in ucurs:                     ucur.Value = scur.getValue("Value")                     # update row                     ucurs.updateRow(ucur)

Outcomes