Check whether file is being written to

Diez B. Roggisch deets at web.de
Thu Sep 23 11:55:52 EDT 2010


Thomas Jollans <thomas at jollybox.de> writes:

> On Thursday 23 September 2010, it occurred to loial to exclaim:
>> How can I check whether a file is being written to by another process
>> before I access it?
>> 
>> Platform is unix.
>
> As such, you can't. But you can lock the file using the functions in the fcntl 
> module.

Last time I checked, file-locking in unix was co-operative.

Diez



More information about the Python-list mailing list