How to lock files (the easiest/best way)?

Jim Segrave jes at nl.demon.net
Sun Jul 16 18:13:37 EDT 2006


In article <12bldoi1v060k3d at corp.supernews.com>,
Jim Segrave  <jes at jes-2.demon.nl> wrote:
>        except OSError, e:
>            if e.errno != errno.EEXIST:

this should read:
             if e.errno != errno.ENOENT:

(it was left with EEXIST from testing this code by forcing an error,
as the code for this failure requires a very tight race condition to test)

>                sys.exit("%s exists but stat() failed: %s" %
>                         (lockfile, e.strerror))
>            # we didn't create the lockfile, so it did exist, but it's


-- 
Jim Segrave           (jes at jes-2.demon.nl)




More information about the Python-list mailing list