wickhamab

need help with UpdateCursor and .updateRow(row)!!!

Discussion created by wickhamab on May 21, 2013
Latest reply on May 21, 2013 by csny490
Hi all,

I am studying python scripting for geoprocessing and am having trouble with a update cursor loop.

"Property_Layer" is a feature layer and I want to narrow the arcpy.UpdateCursor to empty "LOCALITY" fields. I then want to use the for loop to set the "LOCALITY" field to the variable "value".

my code stalls at the rows.updatRow(row) line. I'm not sure I can use a feature layer with the UpdateCursor....!?

I am new to this so any help would be greatly appreciated! 

    rows = arcpy.UpdateCursor ("Property_Layer",'"LOCALITY" = ' + "'" + "'")                                                         

    row = rows.next()
        
        for row in rows:           
            row.setValue ("LOCALITY", value)           
            rows.updateRow(row)
           
            del row, rows   #delete cursors

Outcomes