ipdb显示颜色代码而不是颜色

问题描述:

使用 import ipdb; ipdb.set_trace()插入断点。
首次点击断点时颜色很好,但是第二次点击BP时会显示颜色代码而不是真彩色(按 c )依此类推。

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

它在Windows 7中,python 2.7和2.6有同样的问题。我认为一种解决方法是使用nocolor方案(如何获得nocolor方案?)以及如何使用配色方案解决这个问题?谢谢!

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!

将ipdb用于Windows时,这是一个已知问题: https://github.com/gotcha/ipdb/issues/31

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:


好的......我注释掉了行ipdb / main .py:43,它设置了io.stdout
和sys.stdout。然后我添加了一个通行证声明。

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

现在这似乎适用于我。