Rob Mason wrote:
> Hi Iker,
> I was juggling with a not dissimilar problem today. Trying to get some
> stdout from the telnet lib to flush to file.
> I just cam across this post which did the trick for me:
> http://www.gossamer-threads.com/lists/python/python/658167
> Basically the idea is that you reopen the sys.stdout file descriptor but
> set it to unbuffered for writing

That's a neat trick:
  sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)

For general info on unix buffering, including tips to control it see:
http://www.pixelbeat.org/programming/stdio_buffering/

Mentioned there is a new linux `stdbuf` command which
could be used like: stdbuf -o0 python_command

cheers,
Pádraig.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Python Ireland" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.ie/group/pythonireland?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to