Possible Duplicate:
Python output buffering
Is there any way to get the effect of running python -u from within my code? Failing that, can my program check if it is running in -u mode and exit with an error message if not? This is on linux (ubuntu 8.10 server)
PYTHONUNBUFFEREDenv var to any non-empty string. This is NOT in your code — must be set before python interpreter starts — but is easier than modifying whatever launches your script to add-u. - Beni Cherniavsky-Paskin