sphinx-autorun icon indicating copy to clipboard operation
sphinx-autorun copied to clipboard

Code not shown in case of exceptions

Open lgarcin opened this issue 7 years ago • 3 comments

When an exception is thrown, the code is not shown at all. This occurs in .. runblock:: pyconblocks.

For example

.. runblock:: pycon

    >>> s = (1, 2, 3)
    >>> s[0] = 4

produces


Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment

whereas I'd like to get

>>> s = (1, 2, 3)
>>> s[0] = 4
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment

Is there a way to achieve this ?

lgarcin avatar Sep 10 '17 06:09 lgarcin

It's definitely possible, not sure how trivial it is. I can't promise anything anytime soon.

WhyNotHugo avatar Sep 10 '17 19:09 WhyNotHugo

The same seems to apply when the code raises some warning

leezu avatar Nov 23 '18 15:11 leezu

I have started using rbookdown with the python/reticulate directive instead for generating docs with snippets/output.

endrebak avatar Nov 27 '18 14:11 endrebak