I have a simple script that I use to select features from a ArcSDE database and export them to a personal.gdb.

Currently, I have to manually save and stop my edit session in the MXD so that the script can get a schema lock.

I have been trying to use arcpy.da.Editor at the start of the script to automatically end the edit session, but I have not been able to achieve that thus far.

Is this the correct way to end an edit session in the MXD I am running the script in? I would also like to be able to restart my edit session after the script runs.

import arcpy
import os
from arcpy import env
env.overwriteOutput = True

edit = arcpy.da.Editor
edit.startEditing(False, True)
print 'Stopping Edit'

# Delete Feature class from file Geodatabase
print 'Feature Class Deleted'

# Select by attribute
arcpy.SelectLayerByAttribute_management ( "AddressPoint", "NEW_SELECTION", "   [DISTRICT] = 'Y'" or "[DISTRICT] = 'y'")

# Export selected feature to Geodatabase
print 'feature Class Exported'

# Open Mailer

This is the returned error when I try to run the script with an active edit session.

Runtime error 
Traceback (most recent call last):
File "<string>", line 7, in <module>
TypeError: descriptor 'startEditing' requires a 'Workspace Editor' object   but received a 'bool'

1 Answer 1


As commented by @GISGe, the

arcpy.da.Editor [class] takes a workspace as argument: arcpy.da.Editor(workspace)

whereas you have:

edit = arcpy.da.Editor

See the Syntax section of the Editor class Help

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.