andygar

Accessing Shape field for point feature class through UpdateCursor causes crash

Discussion created by andygar on Mar 30, 2011
Latest reply on Jun 8, 2012 by brumm1dj
I am attemping to snap points in a feature class to their nearest points on a line feature.  See the code mentioned here: http://blog.rtwilson.com/how-to-snap-points-to-lines-in-arcgis-with-python/ I've been playing with this code in ArcGIS 10.0 with Windows 7 Enterprise 64 bit using the Python window where all the data is in a geodatabase.

My problem is when the script gets to the iterative use of UpdateCursor to access the point feature to iteratively update the shape (with the new point), I get an error in execution. When I moved to trying to move through the loop I found that the code failed when trying to update the actual Shape field.

In an attempt to debug this, I tried to manually access the point feature's shape object:

# updated each point using a cursor
rows = arcpy.UpdateCursor( inputFeature, "", "", "NEAR_X, NEAR_Y" )
row = rows.next()

# attempt to access point object
p = arcpy.getValue("Shape")


The last line will always crash ArcMap.

I have attempted the following:
1. Check geometry
2. Repair geometry
3. Tried moving the cursor forward 6-7 times to make sure it wasn't a specific feature in the class that had the problem.

None of these have yielded any result, attempts to access the Shape field programatically still cause ArcMap to crash.

Where do I go next?

Outcomes