howdoi: Cant Print out the colors in Powershell Or CMD Terminal

What happened:

howdoi cant print out colors in Powershell Or CMD terminal in color mode.

> howdoi -c how to extend a list in python --explain
INFO: Version: 2.0.19
INFO: Fetching answers for query: how to extend a list in python
INFO: Using cached links
INFO: Links from stackoverflow.com found on google: 1
INFO: URL: https://stackoverflow.com/questions/252703/what-is-the-difference-between-pythons-list-methods-append-and-extend
INFO: Answers requested: 1, Starting at position: 1
INFO: Total answers returned: 1
>>> x = [1, 2, 3]
>>> x.append([4, 5])
>>> print(x)
[1, 2, 3, [4, 5]]

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Ah I see, you use colorama together with rich and it monitors stdout, rewriting the colors as necessary.

@V2dha would you mind giving that a try on your branch and seeing if the Windows colors look correct? @SepehrRasouli can help test as well.

That’s interesting. I haven’t done too much testing with Windows and colorization. We use pygments to do the highlighting currently.

Would you mind checking out this branch and seeing if that works any better? It uses the rich library and perhaps they have figured out how to work with Powershell.

https://github.com/gleitz/howdoi/pull/443

Then run python -m howdoi -c how to extend a list in python --explain. Here’s what I see:

Screen Shot 2022-01-24 at 12 34 20 PM