How to control I/O buffering besides -u?
Matt Joiner
anacrolix at gmail.com
Sat Sep 26 13:08:56 EDT 2009
You can try flushing, or reopening with no buffering
sys.stdout.flush()
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
On Sun, Sep 27, 2009 at 2:20 AM, Dave Angel <davea at ieee.org> wrote:
> kj wrote:
>>
>> Is there any way to specify unbuffered I/O from *within* the code
>> (rather than via the command-line -u flag)?
>>
>> TIA!
>>
>> kynn
>>
>>
>
> When creating a file object, specify a buffer size of zero. I don't know
> how to change the buffering of a file object that's already been created, as
> stdin, stdout, and stderr are.
>
> DaveA
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list