urgent question, about filesystem-files
Gerhard Häring
gh at ghaering.de
Thu Apr 10 04:56:19 EDT 2008
bvidinli wrote:
> i started python programming a few months ago.
>
> now i need the code to understand if a file already opened in
> filesystem by another process ?
>
> i looked at docs, howtos, but did not find related info.
> note that normal file open/write operations in python, i know it.
>
> i specificly need to know that "is a file already open by some other
> process other than python".
The pragmatic solution here is to not worry about it and let it be the
user's problem if he does something stupid.
It's OS specific how to get at this information. On Linux, for example
you can call the `fuser` program (if installed; on Ubuntu it's in the
psmisc package). But this will only tell you if the same user has the
file open (or if you're root).
-- Gerhard
More information about the Python-list
mailing list