Created
October 14, 2011 14:39
-
-
Save danmichaelo/1287303 to your computer and use it in GitHub Desktop.
python: check if connected to a real terminal, else default to locale
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if sys.stdout.isatty(): | |
| default_encoding = sys.stdout.encoding | |
| else: | |
| default_encoding = locale.getpreferredencoding() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment