1

Ok, so I have looked over the ESRI documentation thoroughly and I'm still baffled by the arcpy data access module and the function undo operation.

So far I have tried:

workspace = pathtofile      
edit = arcpy.da.Editor(workspace)   
edit.startEditing(with_undo = True)
edit.startOperation()
edit.isEditing
arcpy.CalculateField_management("MyTable", "LIFEFORM", 5000)
edit.isEditing
edit.undoOperation()

The undo operation does nothing and the undo button in the user interface indicates that it will remove the added layer, not the field calculate that I just performed.

I was hoping that I could implement the da.Editor into an addin toolbar as a way of avoiding the user from having to turn on an extension or start an edit session on a separate toolbar.

1
  • You need to use the Editor cursor to make the edits, not some other tool.
    – Vince
    Commented May 12, 2015 at 15:56

1 Answer 1

3

undoOperation is only supported if working with versioned data. As per the arcpy.da.Editor help: "Nonversioned edit sessions do not support undo and redo operations."

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.