When using pdb
to debug a python
program:
python -m pdb foo.py
I want to set a breakpoint, but meet following error:
(Pdb) b bar.py:46
*** 'bar.py' not found from sys.path
A small trick is setting breakpoint in main
first and run the program:
(Pdb) b main
Breakpoint 1 at ......
(Pdb) r
......
After breakpoint set for main
is hit, set breakpoint again at bar.py:46
. This time it should work:
(Pdb) b bar.py:46
Breakpoint 2 at ......