How to check whether file is open or not

Gabriel Genellina gagsl-py2 at
Fri Mar 9 02:47:54 CET 2007

En Thu, 08 Mar 2007 11:10:42 -0300, Bart Ogryczak <B.Ogryczak at>  

> On Mar 7, 6:28 am, "Ros" <pyalb... at> wrote:
>> There are 10 files in the folder. I wish to process all the files one
>> by one. But if the files are open or some processing is going on them
>> then I do not want to disturb that process. In that case I would
>> ignore processing that particular file and move to next file.
> If you can with O_EXLOCK flag, it's not open by other
> process. Now that should work on Unix, Linux and MacOS X. All Windows
> proceeding form NT line, are supposed to be POSIX compatible, but
> somehow this flag is not available.

O_EXLOCK is not in POSIX.

Gabriel Genellina

More information about the Python-list mailing list