I know that a Python script can be debugged from the command line with
python -m pdb my_script.py
if my_script.py
is a script
According to the python
command-line manpage the -m flag does the following:
Searches sys.path for the named module and runs the corresponding .py file as a script.
Given this, I would feel confident debugging by running the .py file as per your first example. One thing to keep in mind is that -m searches sys.path
. Luckily, python looks at the current working directory first, so as long as the .py you are debugging is in your cwd, python -m module
and python module.py
equivalent.