Hello, > f1=file('a',"w+",os.O_EXCL|os.O_WRONLY) Have a look at the documentation, the 3'rd parameter to "file" is the buffer size. > So how to I lock this file to prevent from next opening ? Use os.open or the win32all package (with CreateFile). HTH. Miki