The requested operation is invalid on a closed state

934
5
02-07-2018 12:53 AM
KamyakaKasani
New Contributor

While updating the field using update cursor. Getting the error:The requested operation is invalid on a closed state. Here is my code:

editor = arcpy.da.Editor(workspace)

editor.startEditing(False, True)
editor.startOperation()
cursor = arcpy.da.UpdateCursor(<>feature_class,[<fields>]) 

for row in cursor:

# updation stuff comes here 

cursor.updateRow(row)

del row
del cursor 
editor.stopOperation() 
editor.stopEditing(True)
del editor

I appreciate any help or suggestions.

0 Kudos
5 Replies
Asrujit_SenGupta
MVP Regular Contributor
0 Kudos
KamyakaKasani
New Contributor

Even though same error it is throwing.

0 Kudos
XanderBakker
Esri Esteemed Contributor

In  this practically duplicate post The requested operation is invalid on a closed state   you included the creation of the sde connection. Please create it manually using the same configuration and validate manually that you are able to edit the data (Standard or Advanced license required).

KamyakaKasani
New Contributor

Manually I'm able to edit the data. While using arcpy I'm facing error.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Is the data set you are trying to update versioned or not?  Also, it is helpful to provide the actual error message and stack trace along with it.

0 Kudos