On May 30, 1:29 pm, Matteo <[EMAIL PROTECTED]> wrote: > - Write an autoflush class: > class AutoFlush: > def __init__(self, stream): > self.stream = stream > def write(self, text): > self.stream.write(text) > self.stream.flush() > > ... > flog=open('out.log','a') > flog=AutoFlush(flog) > > print >>flog,"I'm a message!" Oops! According to another thread, this won't work for files (but will work for stdio/stderr) Check the thread entitled "print bypasses calling write method for objects inheriting from file?"
-- http://mail.python.org/mailman/listinfo/python-list