Fredrik Lundh wrote: > 5) check the number of links to each file > > n = os.stat(tempfile)[3] > m = os.stat(lockfile)[3]
aw, forget that. I shouldn't trust google over my own code. here's the correct algorithm: f = open(tempfile, "w") f.close() n = os.stat(tempfile)[3] os.link(tempfile, lockfile) m = os.stat(tempfile)[3] if n == m+1: success! where n==1 and m==2. the os.link call can be placed in a try/except clause (if it fails, m won't be 2), or you can use a try/except around the entire thing. </F> -- http://mail.python.org/mailman/listinfo/python-list