2

I am trying to define my workspace as the current version that I am connected to. The Python tool that I am running utilizes the arcpy.da.Editor() function, and I used a workspace variable that is currently hardcoded to reference the database connection file that I am operating out of. Like this:

# Start an edit session
edit = arcpy.da.Editor(workspace)
edit.startEditing(False, True)
edit.startOperation()

*SCRIPT TOOL HERE*

# Stop editing session
edit.stopOperation()
edit.stopEditing(True)

This works just fine, but the problem is that since the workspace variable is hardcoded to reference the database connection file, it is referencing the sde.default version and does not account for the version that I am currently editing within, thus I get an error that states:

workspace already in transaction mode

If I reconnect to the default version, I can rerun the tool without issue, but that is not ideal for obvious reasons.

Instead of the workspace variable being a reference to the database connection, I need to also add in there for the workspace to acknowledge the version that I am connected to.

  • Have you tried edit.startEditing(True, True) – Ben S Nadler Nov 12 '17 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.