How to find out if another process is using a file

Diez B. Roggisch deets at nospam.web.de
Fri Jan 19 06:07:07 EST 2007


Tom Wright wrote:

> 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?

AFAIK it's cooperative.

Diez



More information about the Python-list mailing list