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). The script worked fine on a file geodatabase however when it runs on the SDE feature class, it stalls at the updateCursor function.
"ERROR: 999999: Error executing function....Objects in the class cannot be updated outside an edit session [FSB.DBO.Structures]"
The script breaks on updCursor.updateRow(row):
workspace <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN><SPAN class="string token">"insertworkspace"</SPAN>
edit <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>Editor<SPAN class="punctuation token">(</SPAN>workspace<SPAN class="punctuation token">)</SPAN>
edit<SPAN class="punctuation token">.</SPAN>startEditing<SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">False</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN>
edit<SPAN class="punctuation token">.</SPAN>startOperation<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
updCursor <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>UpdateCursor<SPAN class="punctuation token">(</SPAN>projectedFC<SPAN class="punctuation token">,</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> spatialRef<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> updCursor<SPAN class="punctuation token">:</SPAN>
pnt <SPAN class="operator token">=</SPAN> row<SPAN class="punctuation token">.</SPAN>Shape<SPAN class="punctuation token">.</SPAN>getPart<SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN>
row<SPAN class="punctuation token">.</SPAN>POINT_X <SPAN class="operator token">=</SPAN> pnt<SPAN class="punctuation token">.</SPAN>X
row<SPAN class="punctuation token">.</SPAN>POINT_Y <SPAN class="operator token">=</SPAN> pnt<SPAN class="punctuation token">.</SPAN>Y
updCursor<SPAN class="punctuation token">.</SPAN>updateRow<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">del</SPAN> updCursor<SPAN class="punctuation token">,</SPAN> row
edit<SPAN class="punctuation token">.</SPAN>stopOperation<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
edit<SPAN class="punctuation token">.</SPAN>stopEditing<SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
If anyone has any information, ideas or input on editing data in non versioned SDE with a updatecursor using python it would be greatly appreciated.