Issue
I would like to debug an extension written for Sphinx in interactive mode using pdb which work great for simple scripts. When I execute sphinx-build -M html . _build I get an ValueError. So to debug it I wrote:
ipython3 $(which sphinx-build) --pdb -- -M html . _build
Unfortunately I don't get the full traceback, only the one from the main script sphinx-build:
$ ipython3 $(which sphinx-build) --pdb -- -M html . _build
Running Sphinx v3.1.2
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/sphinx/config.py", line 319,
in eval_config_file
execfile_(filename, namespace)
File "/usr/local/lib/python3.6/dist-packages/sphinx/util/pycompat.py", line 88,
in execfile_
exec(code, _globals)
File "/home/canard/test-sphinx/conf.py", line 17, in <module>
raise ValueError()
ValueError
---------------------------------------------------------------------------
SystemExit Traceback (most recent call last)
/usr/local/bin/sphinx-build in <module>()
9 if __name__ == '__main__':
10 sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
---> 11 sys.exit(main())
SystemExit: 2
> /usr/local/bin/sphinx-build(11)<module>()
7 from sphinx.cmd.build import main
8
9 if __name__ == '__main__':
10 sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
---> 11 sys.exit(main())
ipdb>
How can I see the full traceback?
I tried to simplify the case by adding raise ValueError() into conf.py. So to reproduce just create a new sphinx project with sphinx-quickstart, modify conf.py and add the exception. With this setup you get the same issue. The debugger stops on sys.exit(main())
Solution
RTFM : from the Sphinx manual you may read:
Debugging tips : Use the sphinx-build -P option to run pdb on exceptions.
This doesn't answer your question, but answers your X-Y problem...
Answered By - nowox Answer Checked By - Robin (Python.Easybugfix Admin)
Post a Comment
Post a Comment