[Tutor] Output not legible when debugging with ipdb

Walter Prins wprins at gmail.com
Wed Nov 27 01:17:25 CET 2013


Hi,

Thanks for the highly educational response.

On 26 November 2013 23:24, eryksun <eryksun at gmail.com> wrote:

> On Tue, Nov 26, 2013 at 4:28 PM, Walter Prins <wprins at gmail.com> wrote:
> >
> > honest.  Regarding Powershell (vs for example cmd.exe): The (slightly)
> > perplexing/irritating/annoying thing is that the older cmd.exe shell,
> which
> > uses a standard old-school NT console window, does support ANSI escape
> > sequences (but is otherwise pretty braindead IMHO, for example does not
> > support arbitrary resizing, copy and paste is clunky and so on), while
> the
> > text mode/console window hosting Powershell behaves somewhat differently,
> > and is (IIRC) at least resizable, but apparently doesn't support escape
> > sequences, so there appears to be some differences -- though I realize
> these
> > must be due to features in the shells themselves since they share some
> > common console window functionality.
>
> The cmd shell's built-in "type" and "echo" commands don't parse escape
> sequences. I think "color" is the only command that sets character
> attributes, and only for the entire screen buffer (e.g. "color 0D"
> sets light purple text on a black background).


> Adding escape-sequence support to existing programs such as cmd.exe
> has to be done in the console itself or by hacking the console API.
> ConEmu manages a hidden console window and does all of its own
> display. There's also ANSICON, which injects a DLL (ansi32.dll or
> ansi64.dll) into the process. My guess is that the DLL hooks kernel32
> WriteConsole to look for escape sequences and then scripts the console
> API. However it works, it's very simple to use:


> ANSICON
> https://github.com/adoxa/ansicon
>
> Console API
> http://msdn.microsoft.com/en-us/library/ms682073


Right.  Apologies for belaboring this then, but do you know why the bog
standard cmd.exe (and for that matter Powershell, now that I've actually
checked it as I have it on my machine) has no problem displaying IPython's
colourization?  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

Consoles on my PC for reference:
cmd.exe: http://i.imgur.com/zowlwcw.png
powershell: http://i.imgur.com/HxsNlH8.png

Walter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131127/d5e6a1e7/attachment.html>


More information about the Tutor mailing list