isatty

astropy.utils.console.isatty(file)[source]

Returns True if file is a tty.

Most built-in Python file-like objects have an isatty member, but some user-defined types may not, so this assumes those are not ttys.