AnsweredAssumed Answered

Tuple Error Insert Cursor

Question asked by LANDVEST on Oct 3, 2016
Latest reply on Oct 4, 2016 by bixb0012

My brain is fried...if anyone can/wants to modify the title of the post please do so. I'll attempt to post this w/o giving the background of the tool...if that is necessary I'll happily provide it. Here is my code:

import arcpy, os, sys, math

#Environment settings
outGDB = arcpy.env.scratchGDB
arcpy.env.workspace = outGDB
arcpy.env.overwriteOutput = True

#Local Variables
#startingPt = arcpy.GetParameterAsText(0)
#sampleNumber = int(arcpy.GetParameterAsText(1))
#interDist = int(arcpy.GetParameterAsText(2))
startingPt = "startingPoints"
interDist = 660
outName = "cruisePoints"

#Create target point FC
sr = arcpy.Describe(startingPt).spatialReference
outPoint = arcpy.CreateFeatureclass_management(outGDB,outName,"POINT","","","",sr)
arcpy.AddField_management(outPoint, "CLUSTER_ID", "TEXT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(outPoint, "PLOT_ID", "TEXT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")

#Open Insert Cursor
insert = arcpy.da.InsertCursor(outPoint,["SHAPE@XY","CLUSTER_ID","PLOT_ID"])

fields = ["SHAPE@X", "SHAPE@Y", "OID@"]
with arcpy.da.SearchCursor(startingPt, fields) as cursor:

    for row in cursor:
       #Set Start points
       startX = row[0]
       startY = row[1]
       cluster = row[2]
       print(startX,startY)
       #Calculate quadrant points
       northX = row[0]
       northY = row[1] + interDist
       print(northX, northY)
       eastX = row[0] + interDist
       eastY = row[1]
       southX = row[0]
       southY = row[1] - interDist
       westX = row[0] - interDist
       westY = startY
       start = arcpy.Point(startX, startY)
       print(start)
       north = arcpy.Point(northX, northY)
       east = arcpy.Point(eastX, eastY)
       south = arcpy.Point(southX, southY)
       west = arcpy.Point(westX, westY)
       insert.insertRow([start,row,cluster])
       insert.insertRow([north,row,cluster])
       insert.insertRow([east,row,cluster])
       insert.insertRow([south,row,cluster])
       insert.insertRow([west,row,cluster])
             

del cursor

 

When pasting into the Python Console in Desktop I get the following error (note the third print as well)

Outcomes