Quantcast
Channel: Forums - Geoprocessing
Viewing all articles
Browse latest Browse all 1952

Python WITH statement does not release da cursor schema locks

$
0
0
According to this page
http://resources.arcgis.com/en/help/...0000001q000000

The Python WITH statement should release all data access cursor locks. It doesn't release schema locks. *sr.LOCK files persist. For example, foo remains locked after the following code is run:

Code:

import arcpy
with arcpy.da.SearchCursor( 'C:/Temp/foo.shp' , [ "*" ] ) as cursor:
    for row in cursor:
        print row[0]

My questions are...
1) Is this by design? It kind of makes sense, since one can go on and use the cursor some more even after the with block is exited. Seems like it would be bad to edit the schema while you've got a cursor pointing to that file.

2) if this is not by design, is someone going to fix it soon? If so, when?

3) If this is by design, why use the WITH statement in all the examples? Sure, it gets rid of the read/write locks, but it doesn't remove all locks, so it messes up your workflow anyway.

4) If this is by design, shouldn't the documentation be modified?

Thanks for the help.

Viewing all articles
Browse latest Browse all 1952

Trending Articles