James Hutchison <jamesghutchi...@gmail.com> added the comment:

You are right, when I add:

    def flush(self):
        pass;

the error goes away.

When I have this:

    def flush():
        pass;

I get:

Exception TypeError: 'flush() takes no arguments (1 given)' in 
<__main__.FlushFile object at 0x00C2AB70> ignored

This leads me to believe that sys.stdout.flush() is being called on program 
close

So this would be the correct implementation of my flushfile override:

class FlushFile(object):
    #"""Write-only flushing wrapper for file-type objects."""
    def __init__(self, f):
        self.f = f;
        self.flush = f.flush;
        try:
            self.encoding = f.encoding;
        except:
            pass;
    def write(self, x):
        self.f.write(x)
        self.f.flush()

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12020>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to