# arcpy.da.insertCursor not saving output?

Referencing an answer to Interpolating points along line in Python for ArcGIS Desktop?, I have copied this code verbatim (swapping out my two feature classes; a line layer and an empty point layer) but for some reason it does not save the output (e.g. the point feature class is empty). I'm running it in IDLE and if I leave the Python shell open I can add (after the script runs) the following code:

outPath = r"C:\path\to\MyData\testGDB.gdb"
outName = 'test_points'
ftrCount = int(arcpy.GetCount_management(outPath + "\\" + outName).getOutput(0))


and then I can type

"> ftrCount"


and it returns "17"

So obviously there are seventeen features created that are not being stored in the output feature class.

This is similar to Insert Cursor fails to write results to table but my results ARE in tuple format so I'm failing to understand what is wrong.

If I print the xy variable in the loop I get my state plane coordinates ...

(617914.0259078296, 612215.8199066787)
(617894.1203419868, 612230.9450000166)
(617874.214776144, 612246.0700933544)
(617854.3092103013, 612261.1951866923)
(617834.4036444585, 612276.3202800301)
(617814.4980786156, 612291.445373368)
(617794.5925127729, 612306.5704667058)
(617774.6869469301, 612321.6955600437)
(617754.7813810873, 612336.8206533815)
(617734.8758152445, 612351.9457467194)
(617714.9702494018, 612367.0708400572)
(617695.0646835589, 612382.195933395)
(617675.1591177161, 612397.3210267328)
(617655.2535518734, 612412.4461200706)
(617635.3479860306, 612427.5712134085)
(617615.4424201878, 612442.6963067463)
(617595.536854345, 612457.8214000842)


I think I solved it already.

I changed the last two lines of that script from

xy = (xPoint, yPoint) insertCursor.insertRow([xy])

to ...

xy = (xPoint, yPoint) insertCursor.insertRow(([xy]))

and that got the coordinates into the correct format which appears to be a tuple inside of a list.

I'm not sure why I need a list for just updating the SHAPE@ field and I'm also not sure why the documentation isn't a little bit clearer on this.

• You need a list because that's the expected input (one of them). I'm old-school, so I assemble an arcpy.Array of arcpy.Point objects, then construct a geometry using a SpatialReference – Vince Jan 26 '17 at 23:13
• The help does mention that row must be a tuple (or list, doesn't matter). If you were updating a few extra fields then it would look like ['something', 55, (x,y), None]. That's why you need to wrap the tuple. – Paul Jan 26 '17 at 23:46