[Tutor] Output not legible when debugging with ipdb

eryksun eryksun at gmail.com
Wed Nov 27 02:28:24 CET 2013


On Tue, Nov 26, 2013 at 7:17 PM, Walter Prins <wprins at gmail.com> wrote:
> Actually now that I write this -- I suddenly vaguely remembering installing
> PyReadline back when I was setting up IPython in order to get colour and a
> couple of other things working properly... so presumably it does the ANSI
> interpretation, and that's probably where the colourization is coming from,
> perhaps this is what the OP has missing then?
>
> PyReadline on PyPi: https://pypi.python.org/pypi/pyreadline/2.0

That's the ticket. PyReadline has a console subpackage that uses
ctypes to access the Windows console API. The AnsiWriter class splits
the string into chunks with a given character attribute state (i.e.
color, bold, reverse) to be set by SetConsoleTextAttribute before
writing the chunk to the console.

https://github.com/pyreadline/pyreadline/tree/master/pyreadline/console


More information about the Tutor mailing list