Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Backtraces when using ipdb do not respect -colour LightBG setting #279

Closed
brickZA opened this Issue Feb 21, 2011 · 4 comments

Comments

Projects
None yet
2 participants

brickZA commented Feb 21, 2011

Under Ubuntu Lucid (10.04) packaged ipython 0.10 or self-installed 0.10.1, it seems as if the -colors LightBG setting is ignored for backtraces when used with ipdb. This seems similar to an old bug http://projects.scipy.org/ipython/ipython/ticket/243 that was resolved. I'm not sure if this is an ipdb or ipython issue. Should I create an ipdb issue too?

brickZA commented Feb 21, 2011

OK, I did some further investigation. It seems that ipdb gets its color configuration by doing

from IPython import ipapi

....
def set_trace():
ip = ipapi.get()
def_colors = ip.options.colors

It seems that ipapi.get() always returns the colour options as 'Linux', even when the actual setting is 'LightBG'. If I harcode def_colors = 'LightBG' I do indeed get the light background. for ipdb backtraces.

Is this an error in ipdb's use of the ipython API, or an error wit ipython?

Owner

minrk commented Feb 21, 2011

I can't reproduce this.

I can't make ipdb mismatch setting colors via command-line or via magic after the fact on OSX or Ubuntu with 0.10.1 or 0.11.dev.

Can you do:

from IPython import ipapi
print ipapi.get().options.colors

with various values passed to '--colors'?

brickZA commented Feb 22, 2011

OK. So if I do ipape.get().options.colors in a straight ipython shell, it gives the right answers. Then I instrumented ipdb to print the same info, and it always gave Linux. Then I saw the following lines in ipdb/init.py:

from IPython.Shell import IPShell
...
shell = IPShell(argv=[''])

By commenting out the the last line, the correct info is obtained by ipdb. Presumably a new ipython shell with default options is created by the IPShell() statement. Why would ipdb do this? A quick smoke test seems to indicate that ipdb works OK without it.

P.S. the ipdb file I have matches this one:
https://github.com/gotcha/ipdb/blob/master/ipdb/__init__.py

brickZA commented Feb 22, 2011

Created ipdb issue: gotcha/ipdb#1

@brickZA brickZA referenced this issue in gotcha/ipdb Feb 20, 2014

Closed

-color settings ignored whitin ipdb #1

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment