Gabriel Genellina
2/28/2008 11:53:00 PM
En Thu, 28 Feb 2008 18:04:38 -0200, Ethan Metsger <emetsger@obj-sys.com>
escribió:
> On Thu, 28 Feb 2008 14:48:55 -0500, <castironpi@gmail.com> wrote:
>
>> Can you reproduce the bug on the console? Or, try starting with a new
>> line in the output. Or, try a input().
>
> I can reproduce the issue in the console. I'm not convinced it's
> actually
> a bug, unless for some reason the interpreter is preventing a buffer
> flush.
Try starting the interpreter with python -u xxx.py (-u = unbuffered) but I
don't really think this might be the cause. Are you sure the code actually
says sys.stdout.flush() and not sys.stdout.flush?
> sys.stdout.write ("%s" % (self.name.ljust(30),))
Usually written as:
sys.stdout.write("%-30s" % self.name)
And instead of:
if xxx is True:
...
use:
if xxx:
...
> Is it possible that flushing is prohibited until __exit__ is called?
I don't think so... What's your platform/OS?
Try to post a minimal example showing the problem - copy & paste it, don't
retype. Maybe in the process of reducing your code to find the minimal
example, you find the problem yourself.
Are you aware of the existing framework for unit tests? the unittest
module?
--
Gabriel Genellina