cknd / stackprinter

Debugging-friendly exceptions for Python
MIT License
1.28k stars 37 forks source link

No Colors in Windows (git-bash) / No option to enable colors #49

Closed divyanshu-parihar closed 3 years ago

divyanshu-parihar commented 3 years ago

I am new to this package , so i might not know something

I was using this lib on windows and tried changing styles but this is not showing my err styles.

image code:

import numpy
import stackprinter

def dangerous_function(blub):
    return sorted(blub, key=lambda xs: sum(xs))

try:
    somelist = [[1,2], [3,4]]
    anotherlist = [['5', 6]]
    spam = numpy.zeros((3,3))
    dangerous_function(somelist + anotherlist)
except:
    stackprinter.show(style='darkbg', source_lines=4)

is there anything is need in order to get colors working on windows.

divyanshu-parihar commented 3 years ago

I tried this on git-bash between

cknd commented 3 years ago

Hi! I don't have a windows machine to test this, but I can help you with the relevant keyword: What you need is a terminal that supports ANSI color codes. It sounds like the standard windows terminal didn't have this feature until recently and you need to enable it somehow https://www.google.com/search?q=windows+console+ansi+color+codes

divyanshu-parihar commented 3 years ago

https://github.com/gulpjs/gulp/issues/1292#issuecomment-258090062 I will try this.. later

cknd commented 3 years ago

I'll close this here for now - feel free to reopen if there is a problem with the color codes sent by stackprinter!

divyanshu-parihar commented 3 years ago

Looks like this problem only occur when i use git-bash inside vscode . because normal gitbash can handle colours image

Inside vs code.

image