AnsweredAssumed Answered

setValue not working in arcpy UpdateCursor

Question asked by dogdaynoon on Feb 19, 2017
Latest reply on Feb 19, 2017 by bixb0012

I am try to iterate over 3 feature datasets in 1 gdb and update a field value in all of the feature classes to "No".

ArcMap 10.4.1 Standard license. Windows 7

Here is my code. 

import arcpy
arcpy.env.workspace = r"PATH HERE"

#list of datasets
datasets = ["WaterDistribution", "WastewaterSystem", "Stormwater"]

#field to update
updateField = "AP_CHECKED"
#value to enter into field
value = "No"

for ds in datasets:
for fc in arcpy.ListFeatureClasses("","",ds):
print("Working on DS: {0}, FC: {1}" .format(ds, fc))
cursor = arcpy.UpdateCursor(fc, updateField)
for row in cursor:
row.setValue(updateField, value)
cursor.updateRow(row)

The code runs in the Idle window and the Datasets and FCs are listed from the print line but none of the values change in the db. 

Is the code correct?

 

Thanks,

James

Outcomes