Hi All,Trying to run a basic field update, but getting error. Code: ClassList=["Tree_Canopy", "Impervious", "Vegetation", "Soil", "Water"] AcEvalRas=(os.path.join(DirAc, "AcEvalRas_g"+str(i)+"i")) rows = arcpy.UpdateCursor(AcEvalRas) for row in rows: if row.Value == 1: row.SetValue(row.Class, ClassList[0]) row.SetValue(row.Ref, ClassList[0]) rows.updateRow(row) elif row.Value == 2: row.Class = row.getValue(ClassList[1]) row.Ref = row.getValue(ClassList[1]) rows.updateRow(row) elif row.Value == 3: row.Class = row.getValue(ClassList[2]) row.Ref = row.getValue(ClassList[2]) rows.updateRow(row) elif row.Value == 4: row.Class = row.getValue(ClassList[3]) row.Ref = row.getValue(ClassList[3]) rows.updateRow(row)
Error Code:Traceback (most recent call last): File "X:\\TV_LC_2.4_Accuracy2_overlay.py", line 66, in <module> row.SetValue(row.Class, ClassList[0]) File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\_base.py", line 28, in __getattr__ raise AttributeError("%s" % attr)AttributeError: SetValueLine 66 is the first "SetValue" line.I have tried several different versions, where I use setValue and getValue. I even tried a setValue(row.Class, row.getValue(ClassList[0])). The first elif line seems the cleanest to me, but that gives a 99999 Failure to Execute error. From the error messages, I think the first SetValue from the code above is the best so far. Does the syntax look okay? Any ideas would be great.This is a raster dataset within a GDB. Fields "Class" and "Ref" are both text with default precision.ThanksRich