It looks like something simple but I could not find the answer yet -
I just learned I need to start learning Python and PDB. In my module, I have a normal if __name__ == __main _
is run to execute some code when the module is run as a program.
So far, I want to do it with the Python - mymod arg1 arg2
syntax
Now I want to do exactly the same thing inside PDB. Generally in C, I will do the gdb mybinary
after the run arg1 arg2
but I can not understand how the same thing in PDB get receive.
I'm sure it should be an easy way to get it, but I'm taking a long time looking for it ..
Thank you for your help!
Try:
Python-p pdb mymod .py arg1 arg2
This should start pdb debugging mymod.py (you must specify the path if mymod.py is not in the existing directory).
Alternatively, set your breakpoint code where you want to start debugging. The usual way to get a breakpoint in PDB is to:
If any condition: Import pdb; Pdb.set_trace ()
You can confirm this condition that breakpoints can not be triggered soon.
Comments
Post a Comment