In article <80c56956-f28e-47a3-a723-3a5e3fd29...@j19g2000yqk.googlegroups.com>, sjdevn...@yahoo.com <sjdevn...@yahoo.com> wrote: >On Jan 2, 9:35=A0pm, Dave Angel <da...@ieee.org> wrote: >> >> In Windows, there is a way to do it. It's just not exposed to the >> Python built-in function open(). You use the CreateFile() function, >> with /dwCreationDisposition/ of CREATE_NEW. >> >> It's atomic, and fails politely if the file already exists. >> >> No idea if Unix has a similar functionality. > >It does. In Unix, you'd pass O_CREAT|O_EXCL to the open(2) system >call (O_CREAT means create a new file, O_EXCL means exclusive mode: >fail if the file exists already).
Thanks! -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ import antigravity -- http://mail.python.org/mailman/listinfo/python-list