// In Python 2 on Mac OS X and Linux "sys.stdout.encoding" is set to None.
// On Windows when running in non-interactive terminal it is None.
enc = "None"
elif sys.stdout.isatty():
enc = str(sys.stdout.encoding)
else:
// For non-interactive stderr use locale encoding - ANSI codepage.
After Change
// In Python 2 on Mac OS X and Linux "sys.stdout.encoding" is set to None.
// On Windows when running in non-interactive terminal it is None.
enc = "None"
elif sys.stdout.isatty() or is_py37:
enc = str(sys.stdout.encoding)
else:
// For non-interactive stderr use locale encoding - ANSI codepage.