Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to force color output on Windows #127353

Closed
PalmtopTiger opened this issue Nov 28, 2024 · 2 comments
Closed

Unable to force color output on Windows #127353

PalmtopTiger opened this issue Nov 28, 2024 · 2 comments
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

Comments

@PalmtopTiger
Copy link
Contributor

PalmtopTiger commented Nov 28, 2024

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:
241128153324_unp

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Linked PRs

@PalmtopTiger PalmtopTiger added the type-bug An unexpected behavior, bug, or error label Nov 28, 2024
@ZeroIntensity ZeroIntensity added OS-windows stdlib Python modules in the Lib dir 3.13 bugs and security fixes 3.14 new features, bugs and security fixes labels Nov 28, 2024
@zooba zooba added the topic-repl Related to the interactive shell label Nov 28, 2024
hugovk added a commit to hugovk/cpython that referenced this issue Dec 12, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 12, 2024
hugovk added a commit to hugovk/cpython that referenced this issue Dec 12, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 14, 2024
hugovk pushed a commit that referenced this issue Dec 15, 2024
… (#127944)

gh-127353: Allow to force color output on Windows V2 (GH-127926)
(cherry picked from commit 0ac40ac)

Co-authored-by: Andrey Efremov <[email protected]>
@hugovk
Copy link
Member

hugovk commented Dec 15, 2024

Thank you!

@hugovk hugovk closed this as completed Dec 15, 2024
@PalmtopTiger
Copy link
Contributor Author

@hugovk, thank you too!

srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants