billyarmstrong

Problem using Arcpy Update Cursor

Discussion created by billyarmstrong on Dec 28, 2011
Latest reply on Jan 4, 2012 by billyarmstrong
Hi all,
I'm trying to loop through all the rows of a shapefile field and update the row values, and can't get the Arcpy Update Cursor to work properly. My script crashes when I try to pass the new value that I want to update the row object with. I've tried passing the value as an integer and a string (the field I'm trying to update is an integer type), and I've tried using the row.setValue method as well. Below is my code for creating and using the cursor (code would be properly indented in PyScriptor). If anyone can tell me what I'm doing wrong I would really appreciate it.

rows = arcpy.UpdateCursor(outshp,"","",fname,"")
for row in rows:

         isyear = 1
         row.fname = isyear
         rows.updateRow(row)

del row
del rows

thanks in advance!

Billy

Outcomes