Clarifying when cursor locks are released

2938
11
Jump to solution
03-12-2013 06:53 AM
KerryAlley
Occasional Contributor
Does the following line of code "release" the cursor? 
#Note: rdsmall_lyr has a single selected feature rdsmall_values = sorted(arcpy.da.SearchCursor(rdsmall_lyr, ["UA", "FAID_S", "CTCODE", "RTNUMBER", "AOTCLASS"]))

The help pages state that a cursor can be released by the completion of the cursor (http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001q000000), but I'm not very confident in my understanding of an implicit release.  Any insight would be greatly appreciated! 
I do have an alternative approach that I'm confident tidies up after itself (below), but am hoping I can get away with the simpler code.
with arcpy.da.SearchCursor(rdsmall_lyr, ["UA", "FAID_S", "CTCODE", "RTNUMBER", "AOTCLASS"]) as road_cur:     rdsmall_values = sorted(road_cur)
Tags (2)
0 Kudos
11 Replies
MathewCoyle
Frequent Contributor
Is there a place to track updates on bugs if we know the number?   I'm very interested to see what's going to happen with NIM089529

Apologies if this is stupid questions.  I did try googling it for a while, but no luck yet.

Thanks


You can search for bugs that have been published here.

http://support.esri.com/en/

This one still isn't showing up though. I assume Esri has internal bug tracking that they don't publish immediately, or ever, as I have seen numerous NIM references from Esri support that don't ever show up there under the referenced number.
0 Kudos
LT
by
Occasional Contributor
thanks, Mark.  I'm feeling a bit concerned about it not showing up.  Could this mean that it's not going to be considered as a bug?  I've had several interactions with some Esri folks about this and they pointed out that if you run a script from the command line (or double click it to run in directly with python.exe), this bug doesn't occur.   Or if you run it in Pyscripter this bug doesn't occur. So one suggested solution was to switch IDE's --sort of implying that this wasn't really a bug.  They pointed out several special cases where all the locks ARE deleted.    They said they'd change the documentation to match the current behavior--but they never agreed that the behavior needed to change. 

This bug even occurs within the ArcGIS Python window, for heavens sake.  So...I'm hoping it will get attention very soon.
0 Kudos