AnsweredAssumed Answered

The requested operation is invalid on a closed state

Question asked by gudeman on Mar 25, 2015
Latest reply on Jan 4, 2019 by Caleb1987

I've written a number of python scripts, involving UpdateCursor and InsertCursor, that are meant to be used during an edit session in ArcMap. The workspace is a multi-versioned SDE geodatabase. They scripts work fine as long as I perform at least one manual edit prior to running the script, which runs in ArcToolbox. However, if I begin an edit session and run the script prior to performing a manual edit, I receive an error: "The requested operation is invalid on a closed state."


My understanding of the reference is that unless an edit (either spatial or attribute) is first performed on a feature in the SDE database, the workspace remains in a closed state. I mentioned the workaround above; however, this is necessarily convenient and it's easy to forget. Is there something that can be written into the python script, a function perhaps, that can change the workspace to an open state? This would alleviate the need to perform a manual edit before running the script.


I appreciate any help or suggestions.