#Note: rdsmall_lyr has a single selected feature rdsmall_values = sorted(arcpy.da.SearchCursor(rdsmall_lyr, ["UA", "FAID_S", "CTCODE", "RTNUMBER", "AOTCLASS"]))
with arcpy.da.SearchCursor(rdsmall_lyr, ["UA", "FAID_S", "CTCODE", "RTNUMBER", "AOTCLASS"]) as road_cur: rdsmall_values = sorted(road_cur)
Solved! Go to Solution.
The second statement should release the locks automatically, but there appears to be a bug with this- NIM089529: The data access arcpy cursors do not release locks when using with statement. Otherwise, an easy thing to do to see if it is working is to just watch your workspace in Windows Explorer and see if you see either a shared or exclusive lock file is being applied. They should be pretty easy to spot and will show up as a data type of LOCK.
lock_list = [item.split('.')[0] for item in os.listdir(your_gdb) if item.endswith('.lock') and not item.startswith('_gdb')]
"Otherwise, an easy thing to do to see if it is working is to just watch your workspace in Windows Explorer and see if you see either a shared or exclusive lock file is being applied. They should be pretty easy to spot and will show up as a data type of LOCK."
Would this method of spotting lock files only apply to shapefile, personal and file geodatabases?
Would you need to worry about locks from arcpy.da if you are working with an SDE geodatabase that is built to accomodate multiple users?
Edit: I can't seem to be able to find the NIM entry on the support page though. Is it new?