critical sections protecting multiple processes (not threads)

Skip Montanaro skip at pobox.com
Wed Mar 26 17:14:52 CET 2003


    David> Specifically, I want to test for the existence of a file and open
    David> if non-existent in an atomic fashion.  Obviously, if I cannot do
    David> this atomically, it is possible for the file to not exist when
    David> the test is done but to exist before the creation is done.

    David> I don't really know where to look in the documentation for this.
    David> Any help would be appreciated, as always.

This topic came up back in January.  Here's a Google link to a response of
mine with some untested code:

    http://groups.google.com/groups?q=python+file+access+os.open&hl=en&lr=&ie=UTF-8&oe=UTF-8&scoring=d&selm=mailman.1044021160.3038.python-list%40python.org&rnum=1

That should get you pointed in the right direction.

Skip





More information about the Python-list mailing list