[Tutor] Output not legible when debugging with ipdb

Peter Zorn mail at peterzorn.de
Sat Nov 30 16:21:55 CET 2013


PyReadline is installed with the Anaconda distribution, and Powershell 
displays colored IPython output, but not when I use ipdb for whatever 
reason.

I figured out that

from IPython.core.debugger import Tracer; debug_here = Tracer()
debug_here()

seems to yield the desired result: a debugger with colored code, tab 
completion, etc....

(see 
http://ipython.org/ipython-doc/stable/api/generated/IPython.core.debugger.html?highlight=debugger#IPython.core.debugger)

Thanks,
Peter

On 27.11.2013 00:24, eryksun 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
>
> I agree the Windows console is braindead. It was fine for its day in
> NT 3 and 4 back in the 90s, but it hasn't improved much in 20 years,
> and I doubt it ever will. Maybe with PowerShell you're thinking of the
> Integrated Scripting Environment:
>
> http://technet.microsoft.com/en-us/library/dd819514
>
> For IPython, try the Qt console:
>
> http://ipython.org/ipython-doc/stable/interactive/qtconsole.html



More information about the Tutor mailing list