On 8/29/19, Rhodri James <[email protected]> wrote:
>
> "isatty()" is a method of the io.IOBase class that checks to see
> if the stream is connected to a tty, or to use less jargon, if it is
> interactive. "tty" was I think originally an abbreviation for
> "teletype", but nowadays it refers to any terminal, anywhere you
> get a command line prompt.
In Windows, isatty() is true for any character-type file. This does
not necessarily mean an interactive stream. In particular, NUL is a
character device:
C:\>python -c "import sys;print(sys.stderr.isatty())" 2>NUL
True
But a pipe is not:
C:\>python -c "import sys;print(sys.stderr.isatty())" 2>&1 | more
False
--
https://mail.python.org/mailman/listinfo/python-list