Data Access module's update cursor updates 1000 records then fails with "RuntimeError: The requested operation is invalid on a closed state" when the data is in a versioned SDE.
上次发布: August 25, 2014ArcGIS for Desktop
漏洞 ID 编号
NIM084298
已提交
August 30, 2012
上次修改时间
June 5, 2024
适用范围
ArcGIS for Desktop
找到的版本
10.1
操作系统
Windows OS
操作系统版本
XP
修正版本
10.1
状态
Fixed
此漏洞已得到修复。 有关详细信息,请参阅“版本修复”和“其他信息”(如果适用)。
解决办法
Add a startOperation() and stopOperation() method into the edit session from within the python code. For example: #####import arcpyDBODefault = r"Database Connections\test.sde"Seg = "test.DBO.TestLimits"count = 1print "About to start editing"edit = arcpy.da.Editor(DBODefault)message = "Started Editing database..."edit.startEditing(False, True)edit.startOperation()with da.UpdateCursor(Seg,("Bfield")) as cur: for row in cur: row[0] = "Updated_fake" cur.updateRow(row) message = "Updated "+ str(count) print message count = count +1edit.stopOperation()edit.stopEditing(True)