I am trying to update the atrribute data of a feature class with respect to another one by matching a common field. But it is returning an error for the setValue command. My code looks like:
import arcpy
fc="D:/Geonames_CA.gdb/Export_Output"
fs="D:/abc.gdb/Export"
rows = arcpy.SearchCursor(fc)
fldList=arcpy.ListFields(fc)
rws = arcpy.SearchCursor(fs)
flList=arcpy.ListFields(fs)
for row in rows:
for fld in fldList:
a = row.getValue("PLACE_NAME")
a_xmin=row.getValue("XMIN")
a_xmax=row.getValue("XMAX")
a_ymin=row.getValue("YMIN")
a_ymax=row.getValue("YMAX")
for rw in rws:
for fl in flList:
b = row.getValue("PLACE_NAME")
b_xmin=row.getValue("XMIN")
b_xmax=row.getValue("XMAX")
b_ymin=row.getValue("YMIN")
b_ymax=row.getValue("YMAX")
if b==a:
cursor = arcpy.UpdateCursor(fs)
for r in cursor:
r.setValue(b_xmin, a_xmin)
r.setValue(b_xmax, a_xmax)
r.setValue(b_ymin, a_ymin)
r.setValue(b_ymax, a_ymax)
cursor.updateRow(r)
del r, cursor
I am only getting this error:
Traceback (most recent call last): File "C:\Python27\ArcGIS10.1\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript exec codeObject in main.dict File "D:\Script2.py", line 25, in r.setValue(b_xmin, a_xmin) File "C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\arcobjects\arcobjects.py", line 1007, in setValue return convertArcObjectToPythonObject(self._arc_object.SetValue(*gp_fixargs(args))) RuntimeError: ERROR 999999: Error executing function.