I created a new shapefile and using the cursor I'm trying to add data to the new shapefile using an array. When I run the python script this always shows:
feat.shape = pointArray
File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\arcobjects\_base.py", line 35, in __setattr__
return setattr(self._arc_object, attr, ao)
RuntimeError: ERROR 999999: Error executing function.
The code snippet for the cursor is (in bold is what seems to be the problem):
output = "Points.shp"
arcpy.CreateFeatureclass_management("C:/workspace", output, "POINT")
cur = arcpy.InsertCursor(output)
pointArray = arcpy.Array()
# start point
start = arcpy.Point()
(start.ID, start.X, start.Y) = (1, origin_x, origin_y)
pointArray.add(start)
# end point
end = arcpy.Point()
(end.ID, end.X, end.Y) = (2, end_x, end_y)
pointArray.add(end)
feat = cur.newRow()
feat.shape = pointArray
cur.insertRow(feat)
Any thoughts, I am still new to python.
Thanks
feat.shape = pointArray
File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\arcobjects\_base.py", line 35, in __setattr__
return setattr(self._arc_object, attr, ao)
RuntimeError: ERROR 999999: Error executing function.
The code snippet for the cursor is (in bold is what seems to be the problem):
output = "Points.shp"
arcpy.CreateFeatureclass_management("C:/workspace", output, "POINT")
cur = arcpy.InsertCursor(output)
pointArray = arcpy.Array()
# start point
start = arcpy.Point()
(start.ID, start.X, start.Y) = (1, origin_x, origin_y)
pointArray.add(start)
# end point
end = arcpy.Point()
(end.ID, end.X, end.Y) = (2, end_x, end_y)
pointArray.add(end)
feat = cur.newRow()
feat.shape = pointArray
cur.insertRow(feat)
Any thoughts, I am still new to python.
Thanks