What should go to stdout/stderr and why Python logging write everything to stderr?
Eryk Sun
eryksun at gmail.com
Tue Jan 3 13:31:38 EST 2023
On 1/3/23, c.buhtz at posteo.jp <c.buhtz at posteo.jp> wrote:
>
> If the user request the usage info via "-h" it goes to stdout.
The standard file for application output is sys.stdout. Note that
sys.stdout may be buffered, particularly if it isn't a tty. When a
file is buffered, writes are aggregated and only written to the OS
file when the buffer fills up or is manually flushed.
> Why does logging behave different? DEBUG and INFO imho should go to
> stdout not stderr.
The standard file for error messages and other diagnostic information
is sys.stderr. This file should never be buffered.
More information about the Python-list
mailing list