Locks persistent even having finished the geoprocess

Discussion created by borja.pares on Sep 20, 2011
Latest reply on Sep 23, 2011 by stacyrendall
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
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:

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!