In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Nick Maclaren) wrote: > In article <[EMAIL PROTECTED]>, > Donn Cave <[EMAIL PROTECTED]> writes: > |> In article <[EMAIL PROTECTED]>, > |> "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > |> > "Tom Wright" <[EMAIL PROTECTED]> escribió en el mensaje > |> > news:[EMAIL PROTECTED]
> |> > Use os.open with the O_EXCL flag; will fail if the other process has the > |> > file still open (and will fail if another process is reading the file, > |> > too, > |> > not just if someone is writing). > |> > |> O_EXCL fails if the file exists at all - whether closed or open. > > Yes. In theory. In practice, it usually works on normal files, provided > that all opens are local. Under some circumstances, it will even work > for NFS mounted files, as far as I recall. Mm, by "fail", I meant An attempt to open with O_EXCL set will "fail" if the file exists at all, i.e., the file will not be opened, a negative value will be returned, and errno will be set to EEXIST. What I neglected to mention is that this effect obtains when O_EXCL is used in combination with O_CREAT. Without O_CREAT, O_EXCL doesn't mean anything and is ignored. If there is any significant difference between theory and practice in this matter, it's news to me. Donn
-- http://mail.python.org/mailman/listinfo/python-list