I would like to debug a Python package, let say it is Sphinx.
when I do sphinx-build everything works utile a point I have an exception. Instead of the Traceback I would like to start an interactive session from there in which I can debug my code.
Is that possible?
For instance I am looking for something like:
$ python-debug sphinx-build arg args
...
...
Traceback (oops)
...
>>> print("Oh yeah, now we can play...")
Perhaps pdb might be of use to you. Simply invoke it like so where you want to break into the debugger:
import pdb; pdb.set_trace()
For more details please see the pdb documentation: https://docs.python.org/3/library/pdb.html
Edit: Perhaps more relevant to your question: pdb can be invoked on the command-line like so: python3 -m pdb myscript.py
I think this can help you to figure out where to place a debugger:
If your are using python3.7 Then you can simply call this function breakpoint() or you can also do this by using import pdb; pdb.set_trace().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With