mercredi 29 juillet 2015

[Python] Buffered ouput by default

By default, Python produces buffered output (when you use print).

This could be a problem when you would like to see in "real time" your print(...) for example in a log file.

You can disable the buffer for output, by adding the option "-u" like that :
python -u my_script.py


I had this problem with Tornado + supervisor. I did not understand why my print(..) was not written immediately in my log file => -u option solves my problem !

Aucun commentaire:

Categories