I have an .mdb with a feature class that I want to clip in place - that is, I want to clip it with another polygon, and then store the results back in the original .mdb. I am doing this with arcpy. My current strategy is to clip it to an in-memory feature class, then copy that feature class back over the original.
in_mem = "in_memory/temp_clip" arcpy.Clip_analysis(src_fc, clip_fc, in_mem) arcpy.env.overwriteOutput = True arcpy.CopyFeatures_management(in_mem, src_fc)
However, the CopyFeatures call fails with
ERROR 000601: Cannot delete /path/to/src_fc. May be locked by another application.. As best as I can tell, there is no lock on
src_fc. There is no .ldb with it, there's nothing in
GDB_DatabaseLocks, no program has it open (according to Process Explorer), I've tried restarting my computer, and running compact and repair both from MS Access and
arcpy.Compact_management(). I can edit the database fine in MS Access, it is only Arc that claims there is a lock on it. Therefore, I suspect that there's some obscure lock arc is holding that it doesn't want to be released, or there's a bug somewhere.
So, my question is twofold: First, is there a better way to do what I'm trying to do (replace a feature class with the result of clipping it), and second, if not, how can I resolve this locking issue?