Skip to content
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

AttributeError: 'str' object has no attribute 'priority' in Sphinx 3.5.0 #8885

Closed
ryan-williams opened this issue Feb 14, 2021 · 5 comments
Closed

Comments

@ryan-williams
Copy link

Dask documentation builds started failing when picking up the latest Sphinx (3.5.0); pinning to <3.5.0 seems to work around the issue. See dask/dask#7216 / dask/dask#7217:

Exception occurred:
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/sphinx/builders/html/__init__.py", line 1039, in <lambda>
    ctx['css_files'].sort(key=lambda js: js.priority)
AttributeError: 'str' object has no attribute 'priority'
The full traceback has been saved in /tmp/sphinx-err-z6ie2z11.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
@spacemanspiff2007
Copy link

Same here

@jfbu jfbu added this to the 3.5.1 milestone Feb 15, 2021
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 15, 2021
…ntext

Since 3.5.0, priority has been added to control CSS/JS files.  But it's
not working if projects installs custom CSS/JS files via `html_context`
instead of `html_css_files` and `html_js_files`.  This avoids the crash
to keep it "not broken".
@tk0miya
Copy link
Member

tk0miya commented Feb 15, 2021

Since Sphinx-1.8, configuration variables html_css_files and html_js_files to install custom CSS/JS files for users. Could you migrate these settings, please? I posted #8893 to avoid the crash. But it does not mean all of features (including sorting CSS/JS files) will work.

tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 15, 2021
…ntext

Since 3.5.0, priority has been added to control CSS/JS files.  But it's
not working if projects installs custom CSS/JS files via `html_context`
instead of `html_css_files` and `html_js_files`.  This avoids the crash
to keep it "not broken".
@djhoese
Copy link

djhoese commented Feb 15, 2021

@tk0miya Should using the old html_context have generated a warning? I just started building my sphinx docs with -W so all warnings cause errors and I don't think anything was every raised about it.

Edit: I mean, before #8893 that is.

Edit 2: Converting old html_context to html_css_files did the trick. Thanks!

tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 15, 2021
…ntext

Since 3.5.0, priority has been added to control CSS/JS files.  But it's
not working if projects installs custom CSS/JS files via `html_context`
instead of `html_css_files` and `html_js_files`.  This avoids the crash
to keep it "not broken".
@tk0miya
Copy link
Member

tk0miya commented Feb 15, 2021

In my understanding, html_context was introduced to add custom template variables by users. So it is not designed to override css_files and script_files. So I've never thought a deprecation warning is needed.

But, now I understand some (many?) users have used it to override them. So deprecation period is needed.

tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 15, 2021
…ntext

Since 3.5.0, priority has been added to control CSS/JS files.  But it's
not working if projects installs custom CSS/JS files via `html_context`
instead of `html_css_files` and `html_js_files`.  This avoids the crash
to keep it "not broken".
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 15, 2021
…ntext

Since 3.5.0, priority has been added to control CSS/JS files.  But it's
not working if projects installs custom CSS/JS files via `html_context`
instead of `html_css_files` and `html_js_files`.  This avoids the crash
to keep it "not broken".
WeiqunZhang added a commit to WeiqunZhang/amrex that referenced this issue Feb 15, 2021
WeiqunZhang added a commit to WeiqunZhang/amrex that referenced this issue Feb 15, 2021
WeiqunZhang added a commit to AMReX-Codes/amrex that referenced this issue Feb 15, 2021
tk0miya added a commit that referenced this issue Feb 16, 2021
Fix #8885: html: AttributeError for CSS/JS files on html_context
@tk0miya tk0miya closed this as completed Feb 16, 2021
imphil added a commit to imphil/ibex that referenced this issue Feb 18, 2021
We were using the old html_context which has been deprecated
for a while. This PR switches to html_css_files instead.
See sphinx-doc/sphinx#8885 for more information.
imphil added a commit to imphil/fusesoc that referenced this issue Feb 18, 2021
We were using the old html_context which has been deprecated
for a while. This PR switches to html_css_files instead.
See sphinx-doc/sphinx#8885 for more information.
This was referenced Mar 8, 2021
mgovoni-devel pushed a commit to west-code-development/West that referenced this issue May 26, 2021
* Use updated Docker images.
* Check numerical results and fail the CI if results don't match.
* For now pw.x is always run with 2 MPI processes. Using more
  processes leads to relatively small noises in the wavefunctions,
  which make a noticeable difference in Wstat, and even a larger
  difference in Wfreq. Why this is happening needs further
  investigation.
* Fix doc build with sphinx 3.5.0+.
  (See sphinx-doc/sphinx#8885)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants