问题
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