Closed fabriciodosanjossilva closed 2 years ago
We discussed this problem in PR #506. It seems like CMD and PowerShell cannot handle logging messages from multiple threads without mashing messages together. However, Windows Terminal seems to have fixed this problem. Try installing that and tell us if that fixes the problem.
I tested in Windows Terminal. It worked fine. I did not have the text color issue.
If this is a known limitation of PowerShell and CMD, and it seems that it is not worth to make lichess-bot work with these terminals, then leave it that way and you may close this Github issue.
Thanks!
I don't know if it's a limitation of PowerShell/CMD or of the colorizing library we're using (Rich). I may file a bug report with the Rich library at some point in the future.
Note towards a possible solution:
The function detect_legacy_windows()
in rich.console
returns False
for cmd.exe within windows terminal and True
for cmd.exe for cmd.exe without. Maybe give the RichHandler
a Console
instance which should automatically detect whether a legacy terminal is needed (or use the detect function explicitly).
That didn't work, so I'm all out of ideas. I guess the solution to this is to use Windows Terminal.
I'm using Windows Terminal for a few days. It works fine.
Keep lichess-bot unchanged. I suggest to put a note in the instructions (README.md) mentioning that is advised to use Windows Terminal in order to avoid text formating issues.
This should be fixed with PRs #777 and #800.
When using verbose mode (python lichess-bot.py -v), lichess-bot displays debug text lines, using different colors to differentiate different info. When game finishes, there is an incorrect change to default text color, leading to incorrect colored text from then on. Sometimes text color turns to dark blue, which makes text unreadable. Restarting is the only solution.
In the attached image, the default white text turns into cyan. Red arrows show incorrect color.
It seems that some color control code is set, but not unset.