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
Colorizing doesn't work on Windows with git-bash #609
Comments
I just verified that istty is succeeding and I still have no color |
Hi @julie777, I think the best way of fixing this is to add a conditional dependency on colorama for Windows. At least that is what this line indicates: pyscaffold/src/pyscaffold/termui.py Line 80 in c4469f0
Can you check what is the value of this variable, and also what is the effect of installing (If in the future we move towards |
I will certainly investigate more. (One of the reasons that I am working in the git-bash on Windows environment, instead of just developing on Linux which would make everything easy, is to see how many edge cases that I can find and fix.) |
So it turns out there are a couple problems.
Number 1 will solve itself. I just documented number 2. I might try some other options later, but for now you can close the issue if you like. |
@julie777 does this mean that most people under Windows will have no color? Do you see color if you are using other Python tools? Might also be that we need to change things. Or is it only a problem in git-bash, and this does something strange? |
The problem I have been describing happens with running git-bash on window which creates a terminal using mintty. That is the way I have been running it because installation puts an entry into the start menu to run it. And, the other reason I have been using it is that git-bash and mintty work well with all my terminal (xterm) settings and customization. I will will run a complete set of tests today I was putting off doing a full test for every environment because I don't have everything setup perfectly to jump between them all. [Last night I worked to get more environments working] It is surprising, but even though git-bash, msys2 and mingw64 are all from the msys codebase they have differences:
Cygwin even more differences I had previously been working to identify each one to be able to find their differences and had collected a full set of environment variables defined in bash when running without and dot files. Testing is harder than it should be for some of them as they don't have bash installed in the "Linux" part and can't seem to run it from the Windows install. I have done some communicating with those communities and found ways to identify all the environments which wasn't obvious because printenv doesn't show all the variables that are available. For example the standard variable OSTYPE is defined in the cygwin shell, but not exported to the environment. Environments that can run Windows Python, with apps and tools
Terminals that those "shells" can run in
Not all shells run in all terminals, but it is still a large cross product of shell/env, terminal, color support, column wrapping. |
(Aside: I did try git-bash in Windows terminal originally, but I am so used to having every instance open in a new window that I let the tabbed interface put me. This was before any of the color talks.) The results of my testing are in and I threw away the big table I created as a test matrix because, with one exception, everything is based on the terminal program. ConclusionUsers on Windows should always use Windows Terminal when running shells for the best experience. Sadly, Windows users are going to install Git for windows which includes git-bash. Some of them will option for GUI Git, but others will just run git-bash from the start menu. We could provide a note showing where the appropriate bash is located to use Windows Terminal. Test ResultsNote: when I generically refer to win-bash I mean any of the systems that can be installed on windows to provide Unix commands. (git-bash, MSYS, Mingw, cygwin and Gow. I am going to ignore Gow, because it is primarily for running the commands and its bash doesn't work well as a terminal login shell. The Terminals.Most of the variation in color support and column (window resizing) support can be attributed to the terminal program running the shell. Windows Console
Mintty
My go-to shell is git-bash so I tried to track this down and found references that said this is a problem with mintty, that it can't present as tty because it is actually using a hidden windows console to run bash in and they just using the mintty window as a mirror. Now that I found cygwin working, with the same version of mintty I will have to see if I can track down the difference. Windows Terminal
Mobaxterm
|
Thank you very much @julie777 for the very thorough investigation! I think we have 2 action points here:
Other than that, I would consider the limitations of the terminal program under the optics of "graceful degradation"... |
@abravalheri I will also install colorama and see if that works. I don't understand why we would make colorama optional? Or do you mean conditional based on platform or env? |
☝️ this one! |
Description of your problem
Please provide a minimal, self-contained, and reproducible example.
Please provide the full traceback using the
--very-verbose
flag.Output has no color.
Please provide any additional information below.
istty check is failing, probably because of the know bug in pip
we are also checking for curses and colorama
I understand the check for curses as it is part of the standard library.
However, if we want to use colorama we should be installing it.
Versions and main components
The text was updated successfully, but these errors were encountered: