AnsweredAssumed Answered

abortOperation, do you need to stop editing? arcpy.da.Editor

Question asked by MollyKFoley on Apr 2, 2018
Latest reply on Apr 3, 2018 by Dan_Patterson

Quick question - when you call abortOperation() in an edit session -- you still have to stopEditing() afterward right? abortOperation is described as "canceling" an edit, I wasn't sure if stopEditing was necessary. Does what I have below look appropriate?

 

try:
    editor = arcpy.da.Editor(db_con)
    editor.startEditing(False, False)
    editor.startOperation()
    with arcpy.da.InsertCursor(gpTestWriteFC, ['SHAPE@', 'FirstName', 'LastName']) as iCursor:
        for item in insertList:
            iCursor.insertRow(item)
    editor.stopOperation()
    editor.stopEditing(True)
except:
    if editor.isEditing == True:
        editor.abortOperation()
        editor.stopEditing(False)
        fullError = traceback.format_exc()
        arcpy.AddError(fullError)
        sys.exit(1)

Outcomes