File name too long error when building HTML files

Viewed 305

I'm attempting to build HTML documentation on Ubuntu 18.04 but I'm running into a strange error when I run make html:

Exception occurred:


File "/home/cybo/.local/lib/python3.6/site-packages/nbsphinx.py", line 917, in parse
    with open(dest, 'wb') as f:
OSError: [Errno 36] File name too long: '/home/cybo/Desktop/repositories/h2oai/docs/_build/doctrees/nbsphinx/_build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx__build_doctrees_nbsphinx_examples_autoviz_client_example_autoviz_client_example_11_1.png'

I'm able to fix the error by deleting these folders, but they are created again:

reading sources... [ 44%] _build/html/_build/html/_build/doctrees/nbsphinx/_build/doctrees/nbsphinx/_build/doctrees/nbsphinx/_build/html/_build/doctrees/nbsphinx/_build/doctrees/nbsphinx/examples/autoviz_client_example/autoviz_c

Would appreciate any help, seems to be some sort of circular referencing error that I'm not sure how to fix.

1 Answers

I had the same error using nbsphinx. The problem was that I had neglected to set exclude_patterns in my conf.py and each successive build was creating an HTML file for everything in _build. This meant that each build was exponentially slower than the previous one. What a nightmare!

I fixed it by putting the following in my conf.py:

extensions = [
    'nbsphinx',
    'sphinx.ext.mathjax',
]
exclude_patterns = ['_build', '**.ipynb_checkpoints']

I found this information originally in the nbsphinx instructions. Hope it helps!

Related