[Python-mode] making stack traces clickable in gud.el pdb output.

Andreas Roehler andreas.roehler at online.de
Wed Jan 20 08:55:34 CET 2010


m h wrote:
> Thanks much for the responses!
> 
> On Tue, Jan 19, 2010 at 2:25 PM, Barry Warsaw <barry at python.org> wrote:
>> On Jan 19, 2010, at 12:18 PM, m h wrote:
>>
>>> Wow, didn't you add python support to gud?
>> If I did, it was a million years ago and I don't remember it ;).
>>
> 
> :)
> 
>>> Would you (or anyone else) care to mention their workflow?  I've just
>>> been trying to get python-mode C-c C-c to allow me to use pdb.  But I
>>> get an error:
>>>
>>>> <stdin>(181)_test()
>>> (Pdb)
>>> Traceback (most recent call last):
>>>  File "<stdin>", line 186, in <module>
>>>  File "<stdin>", line 181, in _test
>>>  File "<stdin>", line 181, in _test
>>>  File "/usr/lib64/python2.6/bdb.py", line 46, in trace_dispatch
>>>    return self.dispatch_line(frame)
>>>  File "/usr/lib64/python2.6/bdb.py", line 65, in dispatch_line
>>>    if self.quitting: raise BdbQuit
>>> bdb.BdbQuit
>>>
>>> How do I invoke pdbtrack from python-mode?
>> It's really easy.  You still insert 'import pdb; pdb.set_trace()' at the spot
>> in your code where you want to break.  Then run your code from a shell buffer.
>> When you hit the break point, you'll drop into pdb.  pdb-track will notice the
>> new prompt and you'll be able to interact with it right there.  You'll use pdb
>> commands but you'll get the nice two-screen view with code tracking.
>>
> 
> So just to be explicit about what 'run your code from a shell buffer'.  I tried:
> 
> 1- C-c !
> 2- type `execfile('filename.py')` into python shell
> 3- hit breakpoint/nirvana
> 

Hi,

assume you called ipython with C-c !.
The command then is simply

run  filename.py

pdb works that way too

Andreas




More information about the Python-mode mailing list