ArcMap 10.5.1
In Problems with an Update Cursor I noted that I received an error upon running an update cursor on a table view. I just ran it again and got:
Runtime error
Traceback (most recent call last):
File "<string>", line 10, in <module>
RuntimeError: The operation is not supported within an edit session.
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>UpdateCursor<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'ba_view'</SPAN><SPAN class="punctuation token">,</SPAN>fields<SPAN class="punctuation token">)</SPAN><SPAN class="keyword token">as</SPAN> updatecursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> updatecursor<SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># this is line 10 the error refers to....</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>
I suspect my lack of experience with update cursors is the root cause; I ran it in an edit session in ArcMap to get the error. I don't get the error outside of an edit session.
For some reason, I thought update cursors needed to be run in an edit session: is that not the case?
Joshua Bixby