How to execute multi-line statements within Python's own debugger (PDB)

后端 未结 6 1237
南旧
南旧 2020-12-07 07:06

So I am running a Python script within which I am calling Python\'s debugger, PDB by writing:

import ipdb; ipdb.set_trace()

(iPython\'s ver

6条回答
  •  甜味超标
    2020-12-07 07:28

    In python3 ipdb (and pdb) have a command called interact. It can be used to:

    Start an interactive interpreter (using the code module) whose global namespace contains all the (global and local) names found in the current scope.

    To use it, simply enter interact at the pdb prompt. Among other things, it's useful for applying code spanning multiple lines, and also for avoiding accidental triggering of other pdb commands.

提交回复
热议问题