How to recognize whether a script is running on a tty? February 18, 2023 by Tarik import os, sys os.isatty(sys.stdout.fileno()) or sys.stdout.isatty()