Checking for interactive shell in a Python script December 17, 2023 by Tarik This is often works well enough import os, sys if os.isatty(sys.stdout.fileno()): ...