I have created a script that splits a shapefile into multiple new shapefiles and adds them to an ArcMap document. When running the program a second time to overwrite those shapefiles, lock-files are created and the program cannot overwrite the files.
What I do is I open the document, clear out all layers from that document, then I try to delete all the old shapefiles and then overwrite them, lastly add the new shapefiles to the document, save and close.
The strange thing is that this happens on some computers and not other. I wonder what arcpy methods could cause such locking and how I can clear the lock?
Update: I have now tried to set env.overwriteOutput = True but without result. The code below will simply print the error message. When I close the IDLE python console the lock files disappear.
def delete_month_shape_file(file_path, *args):
message.error("Could not delete month shapefile.")