On Mon, Nov 23, 2009, Aahz wrote:
>
> I'm having some problems with Tim Golden's file_handles.py [*] (details
> below), and it occurs to me that perhaps I should start over and express
> my requirement more broadly and see if someone has a more "Windows
> appropriate" solution: all I really care about is, given a specific
> filepath, whether any other program is currently using the file.
> 
> This would work:
> 
> h = win32file.CreateFile(fname, win32file.GENERIC_READ, 0, None,
>     win32file.OPEN_EXISTING, win32file.FILE_FLAG_NO_BUFFERING, None)
> 
> but I would prefer not to create an exclusive lock, even temporarily.
> Suggestions?

Okay, because of the following page (plus supporting material found
elsewhere), it seems clear that in order to find open files, you need a
device driver to access kernel structures, so I just switched to using
CreateFile() and so far that seems to be working.

http://www.codeproject.com/KB/shell/OpenedFileFinder.aspx
-- 
Aahz (a...@pythoncraft.com)           <*>         http://www.pythoncraft.com/

The best way to get information on Usenet is not to ask a question, but
to post the wrong information.  
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to