What should go to stdout/stderr and why Python logging write everything to stderr?

Eryk Sun eryksun at gmail.com
Tue Jan 3 23:11:10 EST 2023


On 1/3/23, Chris Angelico <rosuav at gmail.com> wrote:
>
> writing the FD is the same as using stdout

Except stdout may be buffered. One should probably flush the buffer
before each raw write to the file descriptor.

> use /dev/tty to reach for the console directly.

On Windows, open "CON" (read or write), "CONIN$" (read-write), or
"CONOUT$" (read-write). Or use the more explicit device paths
"\\.\CON", "\\.\CONIN$", and "\\.\CONOUT$". If the process has no
console, one can call WinAPI AllocConsole() or
AttachConsole(process_id) to obtain one.


More information about the Python-list mailing list