ipdb show color code instead of color

大城市里の小女人 提交于 2019-12-14 01:28:54

问题


Use import ipdb; ipdb.set_trace() to insert breakpoint. Color is fine when first hit the breakpoint, but it shows color code instead of true color when hit the BP the second time (by press c) and so on.

    ←[1;32m     72 ←[1;33m        ←[1;32mimport←[0m ←[0mipdb←[0m←[1;33m;←[0m ←[0mipdb←[0m←[1;33m.←[0m←[0mset_trace←[0m←[1;33m(←[0m←[1;33m)←[0m  ←[1;31m# XXX BREAKPO
    INT←[0m←[1;33m←[0m←[0m

It is in windows 7, python 2.7 and 2.6 have the same issue. I think one work around method is using nocolor scheme (how to get nocolor scheme?) And how to fix this issue with color scheme available? Thanks!


回答1:


It is a known issue when using ipdb for Windows: https://github.com/gotcha/ipdb/issues/31

Apparently, this ticket is still open.

There is a quickfix from a guy that solves the problem:

OK ... I commented out line ipdb/main.py:43 which sets io.stdout and sys.stdout. Then I added a "pass" statement.

This now seems to work for me on windows.



来源:https://stackoverflow.com/questions/19189124/ipdb-show-color-code-instead-of-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!