Hello, I developed a Python script that reads a feature class in a file geodatabase and added to a mxd through arcpy.mapping library functions. The process is as follows:
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
arcpy.MakeFeatureLayer_management(env.workspace + "\\" + s, aux)
addLayer = arcpy.mapping.Layer(aux)
arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")
del addLayer, aux, df
mxd.save()
arcpy.env.workspace = "";
del mxd
Even removing all references of the del command, I still maintain the following blocks in the File GDB to the features that add to the mxd:
_gdb.MAD0WK198.1104.5048.sr.lock
Anno_dee.MAD0WK198.1104.5048.sr.lock
Annotation1.MAD0WK198.1104.5048.sr.lock
Point1.MAD0WK198.1104.5048.sr.lock
Polygon1.MAD0WK198.1104.5048.sr.lock
Polyline1.MAD0WK198.1104.5048.sr.lock
I tried to delete the mxd generated but locks persist. This creates a big problem to me because the process then has a process of erasing entities of the GDB and clear, with the active locks I can not run the delete of each feature.
I noticed that just is arcpy.mapping.AddLayer line (df, addLayer, "BOTTOM") that generates the locks because if they put that line of code not generated, but brother python script ends are not released.
Any suggestion?
Thanks in advance!