question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cant Print out the colors in Powershell Or CMD Terminal

See original GitHub issue

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]]

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gleitzcommented, Jan 25, 2022

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.

1reaction
gleitzcommented, Jan 24, 2022

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot print colored text on Windows - python - Stack Overflow
this solution works in cmd, powershell #first import os import os # make printing colors possible os.system('') # get an amzing reuslt :D ......
Read more >
Change text color in Windows PowerShell #5070 - GitHub
First, start the Windows PowerShell command prompt; Now run the CMD ... cmd exits; powershell starts printing text in "active" color a ......
Read more >
Windows 11 command prompt printing characters instead of ...
To make my output coloured I used the module colorama ( v0.4.4 ), but it only contains constants (which are the characters which...
Read more >
Write-Host (Microsoft.PowerShell.Utility)
The Write-Host cmdlet's primary purpose is to produce for-(host)-display-only output, such as printing colored text like when prompting the user for input ...
Read more >
How to Change PowerShell Color Scheme on Windows 10
Once the Windows PowerShell 'Properties' box pops up, click on the 'Colors' tab, and you'll get a whole host of choices to set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found