I've written a python script (ArcGIS 10.0) for importing point objects from Excel sheets to our ArcSDE database. This works fine, but I'd like to make this script a bit more custamizable by the user and therefore want to use a python list for updating my data. I've tried the following, but unfortunately the update cursor does not work together with a python list and I'm getting the error "Field item does not exist".
import os, arcpy fc = r"C:\temp\temp.gdb\tempFC" rowlist = [("NAME", "Testname"),("COMMENT", "Testcomment")] print "Normal UpdateCursor" fcCursor = arcpy.UpdateCursor(fc) for row in fcCursor: row.NAME = "test 1" row.COMMENT = "test 1" fcCursor.updateRow(row) del row del fcCursor print "Finished" print "UpdateCursor with python list" fcCursor = arcpy.UpdateCursor(fc) for row in fcCursor: for item in rowlist: row.item = item fcCursor.updateRow(row) del row del fcCursor print "Finished"
I've also tried
variable = "row.%s = %s" % (item, item) variable
row.item = item
I'm not getting an error anymore, but nothing will be updated then.
Anyone another idea how to make this work?