how to recognize whether a script is running on a tty?,sys.stdout.isatty()