Error Message
Running a Python script to edit nonversioned data stored in an enterprise geodatabase fails and returns the following runtime error:
Error:
Workspace already in transaction mode
Cause
There are a few possible causes for the error:
- Insufficient license level to edit enterprise geodatabase.
- The InsertCursor() function is used in a loop, as shown in the code sample below.
with arcpy.da.InsertCursor(PatchesFC, icFields) as iCursor:
iCursor.insertRow(rowTuple)
- The with_undo and multiuser_mode parameters of the startEditing() function is incorrect. For more information, refer to the following web help document, ArcGIS Desktop: Editor.
Solution or Workaround
Use one of the following solutions to solve the error:
- Editing versioned data is only available with the Standard or Advanced license. Editing is disabled with the Basic license. Upgrade the license level to enable editing versioned data.
- Declare the InsertCursor() function as an object instead of including it in a loop, as shown in the code snippet below.
iCursor = arcpy.da.InsertCursor(PatchesFC, icFields)
- Set the with_undo and multiuser_mode parameters in the startEditing() function to False. With the parameters set to False, the full control of editing data is granted to the current user. The following code snippet demonstrates how to set the parameters to False.
edit.startEditing(False, False)
Note:
In the startEditing() function, the first parameter is the with_undo parameter and the second parameter is the multiuser_mode parameter.
For example:
startEditing({with_undo}, {multiuser_mode})