how to tell if python script is being run in a terminal or via gui?,sys.stdin.isatty()