I am working with copies of feature Datasets that come from a versioned SDE. The copies are in an un-versioned 'development' SDE. I am attempting to do a field calculation on a single feature class in the development sde. I am trying to activate an editing session in python to work around the versioning but the arcpy.da.Editor is not activating an editing session.
I am more or less copying the code from these two sources:
http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-data-access/editor.htm https://geonet.esri.com/thread/77534
For some reason it will not work, and returns the "Objects in this class cannot be updated outside of an edit session" error.
What am I doing wrong?
import arcpy
workspace = "C:\\Users\\syoklic1\\AppData\\Roaming\\ESRI\\Desktop10.3\\ArcCatalog\\devsde.sde"
fc = "devsde.SYOKLIC1.main"
arcpy.env.workspace = workspace
arcpy.MakeFeatureLayer_management(fc, "fc_layer")
edit = arcpy.da.Editor(workspace)
edit.startEditing(False, True)
edit.startOperation()
with arcpy.da.Editor(workspace) as fieldedit:
arcpy.CalculateField_management(in_table= "fc_layer",
field="MiantenanceArea",
expression="1234",
expression_type="VB",
code_block="")
edit.stopOperation()
edit.stopEditing(True)
Additionally, it works if I do it inside of ArcMap.