I'm trying to use an Insert Cursor to insert a point geometry into an existing point feature class.

I'm finding the coordinate and appending them to a list called rowValues, ex:

rowValues.append("((({0}, {1}), 34))".format(X, Y))

This is giving me a list of value in this format:

((3656320.51246, 1613747.99484), 34)

Here is the cursor I am using:

cursor = arcpy.da.InsertCursor("Points",("SHAPE@XY","QuarterSections"))

When I run this code:

for row in cursor:

I get this follow error:

Traceback (most recent call last):
  File "Quarter.py", line 110, in <module>
TypeError: sequence size must match size of the row

Can I not use the string formatting? I've been trying to figure this out for awhile now, but I'm stumped.


The cursor is expecting a tuple, not a string. You might be able to convert the string to a tuple after the fact using ast.literal_eval() as described in this answer. However, it would be far better practice to produce the tuple without using a string as an intermediary.

The better way to do this would be to change:

"((({0}, {1}), 34))".format(X, Y)


((X, Y), 34)

Is there a particular reason you are using a string?

  • No, you're definitely right. I'm not sure why I was doing it that way. I got it to work. – ianbroad Dec 11 '13 at 0:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.