문제

How to make ipdb prompt colored?

It's difficult to navigate between prints:

enter image description here

도움이 되었습니까?

해결책

There doesn’t appear to be an official way to support this, but it can be easily done by editing the source file in your installation. Go to your site packages directory and

grep -r "ipdb>" *

You’ll see something like this:

ipython-2.1.0-py27_2/lib/python2.7/site-packages/IPython/core/debugger.py:42:prompt = 'ipdb> '

Make a backup of that file, then replace the line with what you’d like the prompt to be, including standard color codes. This will make the prompt green, for example:

prompt = '\x1b[32mipdb> \x1b[0m'

There are many places where you can look up more codes for more customization, e.g. http://www.linuxhowtos.org/Tips%20and%20Tricks/ansi_escape_sequences.htm.

Of course, you will have to repeat these steps with any iPython update.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top