python détecter tty

if sys.stdout.isatty():
    # You're running in a real terminal
else:
    # You're being piped, redirected, cron
VeteranKilo