AnsweredAssumed Answered

Brain cramp with an Insert Cursor

Question asked by jborgion Champion on May 18, 2018
Latest reply on May 18, 2018 by jborgion

I'm developing a script that creates a table adds fields and then populates the values of those fields.  I'm good with creating the table and adding the fields, it's the insert cursor that's giving me grief.  (Perhaps I'm giving the insert cursor grief; it's friday afternoon after all...)


Let's call the table newTable, I have list of the values for each of the fields in order:

# the list values looks like this:
[101, u'Salt Lake County', u'Jordan School District', u'South Jordan City', u'South Salt Lake Valley Mosquito Abatement District', u'Jordan Valley Water Conservancy District', u'Jordan/Canyons Debt Service Area', u'Central Utah Water Conservancy District', u'Crescent Cemetery District', u'South Valley Sewer District']

 However,  when I try to use the list as the source, it errors out with TypeError: sequence size must match size of the row.


I can see where the issue is: when I perform arcpy.ListFields(newTable) I get 11 fields.  But, but the length of my list of values is 10: the difference being the objectid.  I don't quite understand how to accommodate for the OID and the subsequent difference in row size vs the number of list elements.