Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
Just to be sure there are no hidden locks, can you manually 1) copy your src_fc to a new layer in your mdb, 2) delete the src_fc, and 3) rename your copy back to src_fc name? If you can do this, then the issue is no "hidden" locks, but locking at run-time of your script. –  RyanDalton Nov 28 '12 at 22:59
    
When trying to create a new feature class to copy it over to, it fails with ERROR 00090: Error creating table, workspace may be read-only –  Eric W. Nov 28 '12 at 23:38
    
Are you running your script via an ArcGIS Script tool, in the Python window (in Arc), or directly from Python (ArcGIS where is not actively launched by the user)? –  RyanDalton Nov 28 '12 at 23:56
    
And what version number (10.0, 10.1, 9.x) of Arc are you using? –  RyanDalton Nov 28 '12 at 23:57
    
I think I've figured out the issue - the GDB_ColumnInfo table was missing from the .mdb for whatever reason, and I think that caused Arc to fail when trying to write to the .mdb, which it misinterpreted as a failure to acquire a lock. I'll update the post if I confirm that's the issue. –  Eric W. Nov 29 '12 at 0:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.