[Tutor] Editing Data in Non Versioned SDE Using python With An Update Cursor
Steven D'Aprano
steve at pearwood.info
Sat Jan 14 05:09:31 EST 2017
On Fri, Jan 13, 2017 at 12:10:25PM -0330, Nicole King wrote:
> Hello,
>
>
>
> I have a python script that calculates x coordinates , y coordinates for a
> point geometry that sits within a feature dataset of an SDE (SQL Express).
It looks like you are using arcpy, which is a specialised piece of
software that I know very little about. I don't think anyone else here
does either, although you might get lucky.
But I might try to *guess* an answer. See below.
If nobody gives you a good answer, you may have to take your question to
a specialised arcpy forum or mailing list.
But one thing they will almost certainly want is to see more than just
the final error message:
> "ERROR: 999999: Error executing function....Objects in the class cannot be
> updated outside an edit session [FSB.DBO.Structures]"
They will almost certainly want to see the entire traceback, starting
from the line
Traceback
and ending with the error you quoted.
Your code is:
> workspace = arcpy.env.workspace ="insertworkspace"
> edit = arcpy.da.Editor(workspace)
>
> edit.startEditing(False, True)
> edit.startOperation()
>
> updCursor = arcpy.UpdateCursor(projectedFC,"", spatialRef)
> for row in updCursor:
> pnt = row.Shape.getPart(0)
> row.POINT_X = pnt.X
> row.POINT_Y = pnt.Y
> updCursor.updateRow(row)
>
> del updCursor, row
>
> edit.stopOperation()
> edit.stopEditing(True)
My *guess* here is that maybe you need to change the "edit.startEditing"
line. You have:
edit.startEditing(False, True)
but maybe it needs to be
edit.startEditing(True, True)
or something? Try reading the documentation for that command and see if
that helps.
Good luck!
--
Steve
More information about the Tutor
mailing list