Author Jimbofbx
Recipients Jimbofbx, r.david.murray
Date 2011-05-06.18:28:05
SpamBayes Score 7.52238e-08
Marked as misclassified No
Message-id <1304706486.54.0.452592592595.issue12020@psf.upfronthosting.co.za>
In-reply-to
Content
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()
History
Date User Action Args
2011-05-06 18:28:06Jimbofbxsetrecipients: + Jimbofbx, r.david.murray
2011-05-06 18:28:06Jimbofbxsetmessageid: <1304706486.54.0.452592592595.issue12020@psf.upfronthosting.co.za>
2011-05-06 18:28:05Jimbofbxlinkissue12020 messages
2011-05-06 18:28:05Jimbofbxcreate