Unable to force color output on Windows #127353
Labels
3.13
bugs and security fixes
3.14
new features, bugs and security fixes
OS-windows
stdlib
Python modules in the Lib dir
topic-repl
Related to the interactive shell
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
In can_colorize function, nt._supports_virtual_terminal call takes precedence over checking of environment variables. If the terminal emulator does not support this mode, the environment variables are not checked. This is contrary to the behavior on POSIX OSes, where variables are checked first.
There are third-party terminal emulators that support ANSI color codes, but do not support the new API added in Windows 10. For example, ConEmu and Cmder.
Also, the current behavior makes it impossible to output errors with ANSI codes to a file or through a pipe.
Screenshot of exception in ConEmu terminal:
CPython versions tested on:
3.13
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: