How to debug a function under the (pdb) prompt?
jfong at ms4.hinet.net
jfong at ms4.hinet.net
Fri May 10 07:39:54 EDT 2019
For example, there is a file test0.py:
---------
1 def foo():
2 for i in range(3):
3 print(i)
4
5 x = 0
---------
I start the debug session as below. My question is why the break point at line 3 didn't work. How to debug the function foo() at this time?
D:\Works\Python>py -m pdb test0.py
> d:\works\python\test0.py(1)<module>()
-> def foo():
(Pdb) tbreak 5
Breakpoint 1 at d:\works\python\test0.py:5
(Pdb) cont
Deleted breakpoint 1 at d:\works\python\test0.py:5
> d:\works\python\test0.py(5)<module>()
-> x = 0
(Pdb) tbreak 3
Breakpoint 2 at d:\works\python\test0.py:3
(Pdb) foo()
0
1
2
(Pdb)
More information about the Python-list
mailing list