I have a short geoprocessing script with an arcpy.Delete_management() line that keeps throwing a lock error: "ERROR 000464: Cannot get exclusive schema lock. Either being edited or in use by another application."Details: (code pasted below too)I can successfully delete "lrs_buffer" if I skip the lines of code defining the mxd and the layers. However, I can't think of why there would be a lock on "lrs_buffer" due to creating the map document object, since "lrs_buffer" had never been added to the mxd. Also, if I'm using a file geodatabase as a workspace and observe through Windows Explorer, no lock files for "lrs_buffer" are created in this workflow. I am having the same problem if I use a personal geodatabase as my workspace.
import arcpy
arcpy.env.overwrite = True
workspace = r"V:\Projects\Shared\RouteLogSystem\ArcGIS_10_Prototype\Prototype_V10\rtlogptsQAQC\RouteLogPointsQAQC.gdb"
arcpy.mapping.MapDocument(r"V:\Projects\Shared\RouteLogSystem\ArcGIS_10_Prototype\Prototype_V10\rtlogptsQAQC\RouteLogPoints.mxd")
rtlogpts = arcpy.mapping.ListLayers(mxd, "*rtlogpts")[0] #feature class on SDE
lrs = arcpy.mapping.ListLayers(mxd, "*lrs_route_twn")[0] #feature class on SDE
rdsmall_copy = arcpy.mapping.ListLayers(mxd, "rdsmall_arc")[0] #feature class in workspace
bufferFC = "lrs_buffer"
if arcpy.Exists(bufferFC):
arcpy.Delete_management(bufferFC)
arcpy.Buffer_analysis(lrs.dataSource, bufferFC, "2 Meters", dissolve_option = "ALL")
Any ideas about what is happening?Thanks!Kerry