if arcpy.TestSchemaLock(data): try: arcpy.Delete(data) except: # catch error here else: print "Unable to acquire schema lock"
# at beginning of script import gc # Garbage Collector gc.collect() # at end of script collected = gc.collect() print "Garbage collector: collected %d objects." % (collected) # try to delete now...