Possible Duplicate:
DirectoryInfo.Delete(True) Doesn't Delete When Folder Structure is Open in Windows Explorer
Folks, I am writing a python testing harness and part of the project involves uninstalling an application and then reinstalling it every night. Part of the uninstall task involves deleting the data directory. During the day testers/developer will be logging into the computer and occasionally a command prompt and/or log file is left open. This causes my script to fail as windows will not let me delete a file if another process has a handle to it.
I would like to know if it is possible to get the pid of the process that is holding onto the file so I can kill the process with WMI or something like that? I would like to do this without logging people out.
If it is impossible then is there a way, from python, to force logout of all users to to get a system where my script can keep working without waiting for me to show up and kill process/log out users?
Any suggestions at all are greatly welcome. I am not an experienced windows programmer.