Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't enter pdb debugger, by M-X pdb test.py?

Tags:

python

emacs

Under Emacs, I opened a .py file. I want to debug it using pdb.

I hit M-x pdb, then the bottom bar of Emacs asks me:

Run /usr/lib/python2.7/pdb.py (like this): /usr/lib/python2.7/pdb.py test.py

I hit Enter. Then it creates a new buffer showing

Current directory is ~/python_programs/

It doesn't show the prompt of pdb. When I enter pdb commands such as n, they are just entered that new buffer, as if I were editing the buffer. It seems that no pdb is running.

But if I invoke pdb again for my .py file in the same way as above, the bottom bar of Emacs will say:

This program is already being debugged

I am baffled. Do I miss something?

Thanks.

p.s. If it matters, I am using python-mode.el, but I guess the problem has nothing to do with it.

like image 921
Tim Avatar asked Dec 08 '25 21:12

Tim


1 Answers

Emacs command pdb is defined in core. It offers the last file in its history for debugging. Seems you have to replace test.py by the current buffer-file-name.

like image 158
Andreas Röhler Avatar answered Dec 10 '25 09:12

Andreas Röhler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!