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)
with arcpy.da.Editor(workspace) as fieldedit:
    arcpy.CalculateField_management(in_table= "fc_layer",


Additionally, it works if I do it inside of ArcMap.

  • can you register the feature class as versioned in the SDE?
    – NULL.Dude
    Apr 4, 2017 at 19:49
  • Yes I can register the feature dataset but not the feature class individually. There is a different issue that comes up with that. When I register the FD as versioned (manually) Calculate fields works in arcmap but when I run the script it sits there and never finishes processing. I was hoping to avoid figuring out that problem by doing it this way. I am thinking that maybe I can set that parameter (registered as versioned) in the python script as a work around, but I haven't tried yet.
    – Simon.y
    Apr 4, 2017 at 20:30
  • Same problem when I do it within the python script.
    – Simon.y
    Apr 4, 2017 at 21:41
  • Would it help to make fc_layer it's own variable to feed into CalculateField_management? Also have you tried UpdateCursor instead of field calculator?
    – Rex
    Apr 4, 2017 at 23:00
  • @Simon.y I'm confused by your question - you say you are "trying to activate an editing session in python to work around the versioning", but you also say you're working in an "un-versioned 'development' SDE", so which is it? You don't need to work around versioning in an unversioned environment. If it's unversioned, you may not even need the arcpy.da.Editor references.
    – Midavalo
    Apr 6, 2017 at 17:34

1 Answer 1


In the end I chose to go around this barrier and use an SQL update statement inside the script. Refer to arcSDESQLExecute. More of a work-around than a solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.