8000 Sphinx 7.1.0 broke "python-docs-theme" · Issue #11519 · sphinx-doc/sphinx · GitHub
[go: up one dir, main page]

Skip to content

Sphinx 7.1.0 broke "python-docs-theme" #11519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ThimoNeubauer opened this issue Jul 26, 2023 · 5 comments
Closed

Sphinx 7.1.0 broke "python-docs-theme" #11519

ThimoNeubauer opened this issue Jul 26, 2023 · 5 comments

Comments

@ThimoNeubauer
Copy link

Describe the bug

Since the release of Sphinx 7.1.0 we've been seeing

Theme error:
An error happened in rendering the page index.
Reason: OSError(22, 'Invalid argument')

in many of our projects. We're using the "python-docs-theme" which might be the trigger here. A colleague reported seeing the same error with "alabaster" though.

How to Reproduce

This is the (abbreviated) log of a reproducer:

PS E:\temp> py -3 -m virtualenv Sphinx
created virtual environment CPython3.11.4.final.0-64 in 764ms
  creator CPython3Windows(dest=E:\temp\Sphinx, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\TNR1\AppData\Local\pypa\virtualenv)
    added seed packages: pip==23.0.1, setuptools==67.6.0, wheel==0.40.0
  activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
PS E:\temp> .\Sphinx\Scripts\pip install sphinx python-docs-theme
Collecting sphinx
  Using cached sphinx-7.1.0-py3-none-any.whl (3.2 MB)
Collecting python-docs-theme
  Using cached python_docs_theme-2023.5-py3-none-any.whl (17 kB)

... blah blah blah ...

PS E:\temp> cd .\Sphinx\
PS E:\temp\Sphinx> .\Scripts\sphinx-quickstart.exe --sep --project foo --author foo --quiet

Finished: An initial directory structure has been created.

You should now populate your master file E:\temp\Sphinx\source\index.rst and create other documentation
source files. Use the Makefile to build the docs, like so:
   make builder
where "builder" is one of the supported builders, e.g. html, latex or linkcheck.

PS E:\temp\Sphinx> .\Scripts\sphinx-build.exe -D html_theme=python_docs_theme source build
Running Sphinx v7.1.0
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets... copying static files... done
copying extra files... done
done
writing output... [100%] index
Theme error:
An error happened in rendering the page index.
Reason: OSError(22, 'Invalid argument')
PS E:\temp\Sphinx>

To verify that this is indeed a regression:

PS E:\temp> py -3 -m virtualenv OldSphinx
created virtual environment CPython3.11.4.final.0-64 in 403ms
  creator CPython3Windows(dest=E:\temp\OldSphinx, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\TNR1\AppData\Local\pypa\virtualenv)
    added seed packages: pip==23.0.1, setuptools==67.6.0, wheel==0.40.0
  activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
PS E:\temp> cd .\OldSphinx\
PS E:\temp\OldSphinx> .\Scripts\pip install 'sphinx<7.1.0' python-docs-theme
Collecting sphinx<7.1.0
  Using cached sphinx-7.0.1-py3-none-any.whl (3.0 MB)
Collecting python-docs-theme
  Using cached python_docs_theme-2023.5-py3-none-any.whl (17 kB)

... blah blah blah ...

PS E:\temp\OldSphinx> .\Scripts\sphinx-quickstart.exe --sep --project foo --author foo --quiet

Finished: An initial directory structure has been created.

You should now populate your master file E:\temp\OldSphinx\source\index.rst and create other documentation
source files. Use the Makefile to build the docs, like so:
   make builder
where "builder" is one of the supported builders, e.g. html, latex or linkcheck.

PS E:\temp\OldSphinx> .\Scripts\sphinx-build.exe -D html_theme=python_docs_theme source build
Running Sphinx v7.0.1
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
generating indices... genindex done
writing additional pages... search done
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in build.
PS E:\temp\OldSphinx>

Environment Information

Please paste all output below into the bug report template



Platform:              win32; (Windows-10-10.0.19044-SP0)
Python version:        3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)])
Python implementation: CPython
Sphinx version:        7.1.0
Docutils version:      0.20.1
Jinja2 version:        3.1.2
Pygments version:      2.15.1

Sphinx extensions

None

Additional context

No response

@AA-Turner
Copy link
Member

Please can you run with -T to show full tracebacks?

@ThimoNeubauer
Copy link
Author

Sure! I see that you're very well prepared with debug options... Here goes:

Traceback (most recent call last):
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\builders\html\__init__.py", line 1098, in handle_page
    output = self.templates.render(templatename, ctx)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\jinja2glue.py", line 196, in render
    return self.environment.get_template(template).render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\temp\Sphinx\Lib\site-packages\jinja2\environment.py", line 1301, in render
    self.environment.handle_exception()
  File "E:\temp\Sphinx\Lib\site-packages\jinja2\environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\themes\basic\page.html", line 10, in top-level template code
    {%- extends "layout.html" %}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\temp\Sphinx\Lib\site-packages\python_docs_theme\layout.html", line 64, in top-level template code
    <option value="dark">{{ _('Dark') }}</option>
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\themes\default\..\classic\layout.html", line 10, in top-level template code
    {%- extends "basic/layout.html" %}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\themes\default\..\basic\layout.html", line 114, in top-level template code
    {%- block css %}
  File "E:\temp\Sphinx\Lib\site-packages\python_docs_theme\layout.html", line 87, in block 'css'
    {{ super() }}
  File "E:\temp\Sphinx\Lib\site-packages\jinja2\sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\themes\default\..\basic\layout.html", line 115, in block 'css'
    {{- css() }}
  File "E:\temp\Sphinx\Lib\site-packages\jinja2\sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\temp\Sphinx\Lib\site-packages\jinja2\runtime.py", line 777, in _invoke
    rv = self._func(*arguments)
         ^^^^^^^^^^^^^^^^^^^^^^
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\themes\default\..\basic\layout.html", line 95, in template
    {{ css_tag(css) }}
  File "E:\temp\Sphinx\Lib\site-packages\jinja2\sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\builders\html\__init__.py", line 1202, in css_tag
    if checksum := _file_checksum(app.outdir, css.filename):
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\builders\html\__init__.py", line 1254, in _file_checksum
    with open(path.join(outdir, filename), encoding='utf-8') as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument: 'E:\\temp\\Sphinx\\build\\_static/pydoctheme.css?digest=845a48175c3935ba0d7ff16b8ed0072d62fd099f'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\cmd\build.py", line 290, in build_main
    app.build(args.force_all, args.filenames)
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\application.py", line 351, in build
    self.builder.build_update()
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\builders\__init__.py", line 290, in build_update
    self.build(to_build,
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\builders\__init__.py", line 360, in build
    self.write(docnames, list(updated_docnames), method)
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\builders\__init__.py", line 567, in write
    self._write_serial(sorted(docnames))
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\builders\__init__.py", line 577, in _write_serial
    self.write_doc(docname, doctree)
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\builders\html\__init__.py", line 675, in write_doc
    self.handle_page(docname, ctx, event_arg=doctree)
  File "E:\temp\Sphinx\Lib\site-packages\sphinx\builders\html\__init__.py", line 1105, in handle_page
    raise ThemeError(__("An error happened in rendering the page %s.\nReason: %r") %
sphinx.errors.ThemeError: An error happened in rendering the page index.
Reason: OSError(22, 'Invalid argument')

Theme error:
An error happened in rendering the page index.
Reason: OSError(22, 'Invalid argument')

@humitos
Copy link
Contributor
humitos commented Jul 26, 2023

I think this is a dup of #11518

@ThimoNeubauer
Copy link
Author

True, that sounds very similar! I did search for open issues containing OSError but weirdly enough #11518 doesn't show there

@picnixz
Copy link
Member
picnixz commented Jul 26, 2023

(it doesn't show because it was closed)

@AA-Turner AA-Turner closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0