Repository navigation
Closed
Labels
bugSomething isn't working
Description
Describe the bug
When I use Sphinx >= 8.1 and sphinx-design 0.6 on Windows, and sphinx-design is the first extension to use the static path, the following error occurs with sphinx-build -v -b html . _build/iso-html
Traceback (most recent call last):
File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx\events.py", line 404, in emit
results.append(listener.handler(self.app, *args))
File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx_design\extension.py", line 86, in update_css_js
static_path.mkdir(exist_ok=True)
File "C:\Users\robin\AppData\Roaming\uv\python\cpython-3.10.12-windows-x86_64-none\lib\pathlib.py", line 1175, in mkdir
self._accessor.mkdir(self, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\robin\\Documents\\git\\bsb\\packages\\bsb-hdf5\\docs\\_build\\iso-html\\_sphinx_design_static'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx\cmd\build.py", line 496, in build_main
app = Sphinx(
File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx\application.py", line 295, in __init__
self._init_builder()
File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx\application.py", line 369, in _init_builder
self.events.emit('builder-inited')
File "C:\Users\robin\Documents\git\bsb\packages\bsb-hdf5\.venv\lib\site-packages\sphinx\events.py", line 415, in emit
raise ExtensionError(
sphinx.errors.ExtensionError: Handler <function update_css_js at 0x0000019B5B241E10> for event 'builder-inited' threw an exception (exception: [WinError 3] The system cannot find the path specified: 'C:\\Users\\robin\\Documents\\git\\bsb\\packages\\bsb-hdf5\\docs\\_build\\iso-html\\_sphinx_design_static')
Extension error (sphinx_design.extension):
Handler <function update_css_js at 0x0000019B5B241E10> for event 'builder-inited' threw an exception (exception: [WinError 3] The system cannot find the path specified: 'C:\\Users\\robin\\Documents\\git\\bsb\\packages\\bsb-hdf5\\docs\\_build\\iso-html\\_sphinx_design_static')
Adding parents=True to the mkdir call solves the problem. I'm not sure if it's the correct solution, perhaps there's an underlying issue that causes the build directory to be absent? The Sphinx build continues correctly after that.
If the build directory existed from the previous build (even though it should have been rm'ed by rimraf) the error also does not occur. So as far as I can tell there seems to be a problem with my filesystem/Sphinx/... and the _build/iso-html build directory is behaving weirdly.
Reproduce the bug
- Use
sphinx>=8.1,sphinx-design~=0.6 - Add it as only extension
- Run
sphinx-build -b html . _build/iso-htmlon Windows
List your environment
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
Fix issue where build directory does not exist yet during 'builder-in…
Helveg commentedon May 3, 2025
I found the underlying problem! This occurs when you forget to add
sphinx_designto your extensions list inconf.py, what surprises me is that anysphinx-designcode is running at all in my sphinx build then?What to do here then, maybe raise a more informative error? I'll close my PR #236 then because that would silence this problem.
♻️ Serve static assets via html_static_path
♻️ Serve static assets via html_static_path
♻️ Serve static assets via html_static_path
♻️ Serve static assets via html_static_path (executablebooks#276)