sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

Extension throwing an exception provides no helpful debug info

Open sebastien-riou opened this issue 3 years ago • 1 comments

Describe the bug

The issue is similar to https://github.com/sphinx-doc/sphinx/issues/7868 : some error happens, apparently within the jupyter extension, but the error message does not allow to debug further. I cannot add to this original issue so I created a new one here.

(Documentation) ghita@ubuntu:~/Documents/secure-risc-v/Documentation/docs$ make html
Running Sphinx v5.0.2
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 41 source files that are out of date
updating environment: [new config] 41 added, 0 changed, 0 removed
executing BASEs... [ 34%] TSys/SW/BASE                                                                                                                                                                 

Extension error (jupyter_sphinx):
Handler <function build_finished at 0x7f08d16baaf0> for event 'build-finished' threw an exception (exception: [Errno 17] File exists: '/home/ghita/Documents/secure-risc-v/Documentation/docs/_build_details/html/_static')
make: *** [Makefile:31: html] Error 2
(Documentation) ghita@ubuntu:~/Documents/secure-risc-v/Documentation/docs$ 

I tried to delete the "_static" file but it is created again by Sphinx. When the build is successful, "_static" is actually a folder, not a file.

I know very well the actual cause of the error. The difference between a successful build and a failed one is an update in the python package that the doc is documenting. A code example such as the one below is in the doc:

Example:
  .. jupyter-execute::

    channel = bytearray([0x00])
    decrypt = bytearray([0x80])
    keyId = bytearray([0x01,0x00,0x00,0x00])

  .. jupyter-execute::
    :hide-code:

    pysatl.Utils.hexstr(CryptoCommands.FaesSetup(channel=channel,decrypt=decrypt,keyId=keyId).to_bytes())

The error is within the CryptoCommands.FaesSetup call which fails with the exception AttributeError: 'bytearray' object has no attribute 'to_bytes'.

How to Reproduce

unfortunately, I cannot share the sources due to company restriction

Expected behavior

an error message which gives some hint about which source file or setting is causing the error

Your project

unfortunately, I cannot share the sources due to company restriction

Screenshots

No response

OS

Linux

Python version

3.9.5

Sphinx version

5.0.2

Sphinx extensions

jupyter-sphinx 0.4.0

Extra tools

No response

Additional context

No response

sebastien-riou avatar Jul 19 '22 12:07 sebastien-riou

Could you pass -T option to the sphinx-build command, please? Then you can see the full stacktrace.

tk0miya avatar Jul 23 '22 18:07 tk0miya