1

I have an application that uses the scratch geodatabase. Upon completion of our work, we delete the scratch geodatabase. The next time our app runs, scratch gets recreated automatically. How do I test for exclusive access to scratch prior to attempting the delete? During some recent debug activities, I had ArcMap open and was consuming some of the feature classes in the gdb. This caused an error when the delete process ran.

1
  • I'm not sure but you may be able to check for a lock file in the GDB which may indicate a fc is open elsewhere. Mar 18, 2015 at 17:24

1 Answer 1

1

If all you need the exclusive access for is to check if it is safe to delete the geodatabase, you could just put the delete command in a try block and ignore any exceptions. Something like

try:
  arcpy.Delete_management(your gdb here)
except:
  pass

If it is in use it will throw a specific exception (ERROR 000464), detailed here: http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000052000000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.