I am using an insert cursor to put all of the values for the field "Size" into all of the rows in my dbf. Here is the code that I am using:

for i in range(0,144779): cursor2=arcpy.da.InsertCursor("Distance_Table.dbf",["Size"]) cursor2.insertRow(1) #Delete cursor object del cursor2 

I know that the last record in the table was 144,779. I put it into the range statement to see whether the value of the variable I had calculated was causing the error and it was not. I keep getting this message "TypeError: argument must be sequence of values." I am putting the same size value in all and I will use an update cursor to update the values.

1

1 Answer

You should create the cursor first, then iterate over your range of values. Here, you create a new cursor for each iteration.

Also, the row object you insert is a tuple and it should be enclosed with round brackets, even if there is only 1 field:

cursor2 = arcpy.da.InsertCursor("Distance_Table.dbf",["Size"]) for i in range(0,144779): cursor2.insertRow((1)) #Delete cursor object del cursor2 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy