I have a nested python package structure that I can install and run different parts of. For example, to start the Tornado/Flask web server, I execute the following:
python3 -m mytool.web -c myconfig.yaml
Where the web package contains both an __init__.py and a __main__.py. I use this structure in several other components, so once the package is installed it's easy to run, which I do in containers.
My issue is when I'm trying to debug with pdb. Since pdb is started a similar way I start my package components, i.e. python3 -m pdb /path/to/debuging/file.py, I don't know how I can use the pdb tool to debug something else that is ran directly as a package.
python3 -m pdb mytool.web -c myconfig.yaml doesn't work.
Any suggestions?
ipython --pdb -m mytool.web -- -c myconfig.yaml
This form also works for regular script invocation without the -m
(you need the -- in both forms to make ipython stop consuming args
and pass them to your module/script)
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