Skip to main content
2 of 5
added 4 characters in body
grego
  • 1.1k
  • 7
  • 19

StopIteration: iteration not started error in arcpy.da.UpdateCursor

I cannot figure out why I keep getting this "StopIteration: iteration not started"error. I have confirmed the feature class 'vriTHLB_eliminated' exists and has records and all required fields.

Here is a simplified version of my code:

fieldList = ["SPECIES_CD_1","area_ha"]
with arcpy.da.UpdateCursor(vriTHLB_eliminated,fieldList) as cursor:` 
    for row in cursor:
    if row[0] == None or row[0] == "":  # If species 1 is null / absent / or empty string;
         cursor.deleteRow()             # delete these rows, they do not help with analysis.

    cursor.updateRow(row) #this definitely does need to indented inside the loop like this
del row, cursor

Any help would be greatly appreciated!

grego
  • 1.1k
  • 7
  • 19