UpdateCursor fails after 2 rows

Discussion created by rmartin4 on Aug 16, 2012
Latest reply on Aug 17, 2012 by rmartin4
I am working on a script that updates the symbol rotation of a point class based on the geometry of an intersecting line class. The workflow is all there but I am having issues at the very end where I update the rotation field. I set an UpdateCursor which runs fine for two objects, and then ends the for loop without giving any errors or weird output. If I take the cursor out of the for loop it runs till the end, so I'm guessing that's where the problem is.

This is what the code looks like:

updateRows = arcpy.UpdateCursor("curSCLyr")
updateRow = updateRows.next()
updateRow.setValue(rotationField, angle)

Is there any way to count the rows seen by the cursor? If I do a GetCount on the layer itself the number is correct.

Any insights are much appreciated!