agarem

Error: Cannot get exclusive schema lock

Discussion created by agarem on Jan 16, 2013
Latest reply on Jan 17, 2013 by mzcoyle
Hello
I am getting an error 000464: Cannot get exclusive schema lock. Either being edited or in use by another application. Failed to execute deletefield

import arcpy

arcpy.env.workspace = "W:\ENG\Geomatics\GIS\Eastern Region Geodatabase.gdb"

arcpy.geoprocessing.env.overwriteOutput = True

arcpy.Buffer_analysis("ER_5_Year_Program", "W:\ENG\Geomatics\GIS\Map & Data Requests\Contracts\Maintenance\Culverts\Data\Culvert Utilities\Program_Buff", "350 METERS", "FULL", "FLAT", "NONE")

targetFeatures = "W:\ENG\Geomatics\GIS\Eastern Region Geodatabase.gdb\ER_Culverts"
joinFeatures = "W:\ENG\Geomatics\GIS\Map & Data Requests\Contracts\Maintenance\Culverts\Data\Culvert Utilities\Program_Buff"
 
outfc = "W:\ENG\Geomatics\GIS\Map & Data Requests\Contracts\Maintenance\Culverts\Data\Culvert Utilities\Culvert_5YCP.shp"
 
fieldmappings = arcpy.FieldMappings()
fieldmappings.addTable("ER_Culverts")
fieldmappings.addTable("W:\ENG\Geomatics\GIS\Map & Data Requests\Contracts\Maintenance\Culverts\Data\Culvert Utilities\Program_Buff.shp")

GWPFieldIndex = fieldmappings.findFieldMapIndex("GWP")
fieldmap = fieldmappings.getFieldMap(GWPFieldIndex)
field = fieldmap.outputField

field.name = "WP"
field.length = "100"
fieldmap.outputField = field

fieldmap.mergeRule = "Join"
fieldmap.joinDelimiter = ","
fieldmappings.replaceFieldMap(GWPFieldIndex, fieldmap)

arcpy.SpatialJoin_analysis("ER_Culverts", "W:\ENG\Geomatics\GIS\Map & Data Requests\Contracts\Maintenance\Culverts\Data\Culvert Utilities\Program_Buff.shp", outfc,"JOIN_ONE_TO_ONE","KEEP_COMMON", fieldmappings)

arcpy.ResetEnvironments()
arcpy.env.workspace = "W:\ENG\Geomatics\GIS\Map & Data Requests\Contracts\Maintenance\Culverts\Data\Culvert Utilities"

arcpy.Select_analysis("Culvert_5YCP.shp", "Culverts_to_Review", '''"STD_CND" in ('Poor', 'Very Poor', 'Unknown', '')''')

arcpy.DeleteField_management("Culverts_to_Review", "COMMENT;YEAR;Join_Count;TARGET_FID;Shape_Le_1;BUFF_DIST")

arcpy.Delete_management("Culvert_5YCP.shp")

arcpy.Delete_management("Program_Buff.shp")


The culverts to review.shp is in a file on our network drive and not in a gdb, no one else is accessing it but me. Any ideas as to why I would be getting this error?
Thanks

Outcomes