Debugging python programs in emacs

前端 未结 3 1337
攒了一身酷
攒了一身酷 2021-01-30 01:22

How to debug python programs in emacs?

I use python-mode.el

I get reference like

import pdb; pdb.set_trace();

bu

3条回答
  •  梦毁少年i
    2021-01-30 02:00

    Type M-x cd to change directory to the location of the program you wish to debug. Type M-x pdb. You'll be prompted with Run pdb (like this): pdb. Enter the name of the program (e.g. test.py).

    At the (Pdb) prompt, type help to learn about how to use pdb.

    Alternatively, you can put

    import pdb 
    pdb.set_trace()
    

    right inside your program (e.g. test.py). Now type M-x shell to get a shell prompt. When you run your program, you'll be dumped into pdb at the point where pdb.set_trace() is executed.

提交回复
热议问题