O_APPEND & O_WRONLY

waalp waalp at pissed.co.uk
Tue Dec 11 06:43:11 EST 2001


I'm trying to open a file in append mode (using python under ms windows)
if i use the O_APPEND parameter i get a errormessage from the interpreter
like this:
OSError: [Errno 9] Bad file descriptor

But if i use the O_WRONLY parameter everything goes write.

But i want to append the file, not overwrite it?

am i doing something wrong here?

my code:
#!/usr/bin/python
from os import *

def writeLog(logMSG):
    logfd = open('event.log',O_APPEND)
    write(logfd, logMSG)
    close(logfd)

writeLog('hello world')


Thanks in advance,
Peter





More information about the Python-list mailing list