libb.stream_is_tty

stream_is_tty(somestream)[source]

Check if a stream is running in a terminal.

Parameters:

somestream – Stream to check (typically sys.stdout).

Returns:

True if stream is a TTY.

Return type:

bool

Example:

>>> import io
>>> stream_is_tty(io.StringIO())
False