Closed
Description
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
- gh-127353: Allow to force color output on Windows #127354
- [3.13] gh-127353: Allow to force color output on Windows (GH-127354) #127886
- Revert "gh-127353: Allow to force color output on Windows (#127354)" #127889
- gh-127353: Allow to force color output on Windows V2 #127926
- [3.13] gh-127353: Allow to force color output on Windows V2 (GH-127926) #127944