QuantEcon / sphinxcontrib-jupyter

A Sphinx Extension for Generating Jupyter Notebooks
BSD 3-Clause "New" or "Revised" License
76 stars 23 forks source link

How to raise an exception to debug sphinx execution #89

Closed mmcky closed 6 years ago

mmcky commented 6 years ago

It is unclear how to halt execution in sphinx extension using the standard approaches

import pdb; pdb.set_trace() is ignored -P option for sphinx-build is ignored when raise Exception is issued and print statements are clearly captured

anyone have any tips. I have read: http://www.sphinx-doc.org/en/master/man/sphinx-build.html http://www.sphinx-doc.org/en/master/devguide.html#debugging-tips

I have a problem where I would like to expose the node structure and introspect the object at a specific point in time.

mmcky commented 6 years ago

@FelipeMaldonado specifically I would like to inspect the node object while executing visit_only().

mmcky commented 6 years ago

@NickSifniotis if you had a spare minute - do you remember how you inspected the node object? while one is debugging the sphinx extension.

mmcky commented 6 years ago

I think we need to integrate with sphinx.util.logging but not sure how this works. I have tried setting

logger = logging.getLogger("sphinx")

and then issuing messages using logger.info(<msg>) but this doesn't work.

mmcky commented 6 years ago

this has been resolved. I was trying to raise an exception in an element of the document that was parsed during transform phase and therefore was already handled prior to Writer phase in Sphinx.