How to find out if another process is using a file

Tom Wright tew24 at spam.ac.uk
Fri Jan 19 11:57:37 CET 2007


js  wrote:
> How about using lock?
> Let writing process locks the files before writing, and unlock after
> the job's done.

Is locking mandatory or co-operative? I don't have any control over the
process which is doing the writing, so if it's co-operative it's no good to
me.

If it's mandatory, then I can try to acquire a lock on the file - if this
fails or blocks, then the other process must have it open.  Will this work?



More information about the Python-list mailing list