Skip to content

Missing build directory leads to builder-inited error #235

Description

@Helveg

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

  1. Use sphinx>=8.1, sphinx-design~=0.6
  2. Add it as only extension
  3. Run sphinx-build -b html . _build/iso-html on Windows

List your environment

No response

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions