Reading from sys.stdin reads the whole file in
Peter Otten
__peter__ at web.de
Wed Aug 27 05:31:45 EDT 2014
Marko Rauhamaa wrote:
> Peter Otten <__peter__ at web.de>:
>
>> In addition to what already has been said: you can switch off output
>> buffering of stdout/stderr with
>>
>> python -u out.py
>>
>> or by setting the PYTHONUNBUFFERED environment variable.
>
> Very often such externalities are not in the control of the application
> developer.
Sometimes it's possible to use a wrapper script rather than to sprinkle your
code with flush().
Sometimes the "offending" python script is not even written and maintained
by you, and setting an environment variable may be a price you are willing
to pay to keep it that way.
More information about the Python-list
mailing list