[IPython-user] Re: silly question about ipython and pdb integration

Fernando Perez Fernando.Perez at colorado.edu
Mon Aug 15 16:14:58 CDT 2005


Hi Michael,

[ please direct ipython-related questions to the user list so they get 
archived, and we benefit from others' input as well.  Note that the list 
requires subscription (way too much spam otherwise). ]

Michael Godbout wrote:

> I'm new to ipython and I find it great. However, there's one thing
> that really annoys me and I'm sure it's because I'm not using it
> correctly, but try as I might, I can't find anything that documents
> this.
> 
> When I %run script.py (script.py is just an arbitrary script), and an
> exception happens, ipython enters pdb.  That's fine.
> 
> Now in this mode, I no longer have tab-completion, which is annoying,
> but at least I can look at the variables. But then, how do I quit the
> debugger so that I can %run again?  ie. return to the regular mode.

Mmh, I do get tab-completion under linux:

In [11]: xx
---------------------------------------------------------------------------
exceptions.NameError                                 Traceback (most recent 
call last)

/home/fperez/test/<console>

NameError: name 'xx' is not defined
 > <console>(1)?()
(Pdb) a.
a.capitalize  a.expandtabs  a.islower     a.lower       a.rstrip      a.title
a.center      a.find        a.isspace     a.lstrip      a.split       a.translate
a.count       a.index       a.istitle     a.replace     a.splitlines  a.upper
a.decode      a.isalnum     a.isupper     a.rfind       a.startswith  a.zfill
a.encode      a.isalpha     a.join        a.rindex      a.strip
a.endswith    a.isdigit     a.ljust       a.rjust       a.swapcase

But I don't know what happens under win32 (which your other message said you 
were using).

> In plain pdb, I just type q, but in ipython, nothing seems to work. 
> Finally, I just %Quit but that means I have to start a new shell,
> change directories, setup the environement just to run again: this is
> very annoying. As I said, I looked through the documentation but
> didn't find hwow to do this, so I assume it's so basic that any idiot
> should know it.
> 
> I'm an idiot I guess. So how do I do it?

Well, a plain 'q' does indeed quit under *nix.  Given that pdb is pure python, 
I find it very surprising it doesn't for you:

In [6]: pdb
Automatic pdb calling has been turned ON

In [7]: xx
---------------------------------------------------------------------------
exceptions.NameError                                 Traceback (most recent 
call last)

/home/fperez/test/<console>

NameError: name 'xx' is not defined
 > <console>(1)?()
(Pdb) help

Documented commands (type help <topic>):
========================================
EOF    break  condition  disable  help    list  q       step     w
a      bt     cont       down     ignore  n     quit    tbreak   whatis
alias  c      continue   enable   j       next  r       u        where
args   cl     d          exit     jump    p     return  unalias
b      clear  debug      h        l       pp    s       up

Miscellaneous help topics:
==========================
exec  pdb

Undocumented commands:
======================
retval  rv

(Pdb) help q
q(uit) or exit - Quit from the debugger.
The program being executed is aborted.
(Pdb) help quit
q(uit) or exit - Quit from the debugger.
The program being executed is aborted.
(Pdb) q

In [8]:  # back in ipython


Can you please paste _exactly_ the screen output you get from trying the above 
on your system?

Cheers,

f




More information about the IPython-user mailing list