sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.43k stars 2.1k forks source link

Stylesheet: error in Sphinx 1.6 #3754

Closed pcav closed 7 years ago

pcav commented 7 years ago

Just upgraded, I get a new error: Exception occurred while building, starting debugger:

Traceback (most recent call last):
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx/cmdline.py",
line 306, in main
    app.build(opts.force_all, filenames)
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx/application.py",
line 338, in build
    self.builder.build_update()
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx/builders/__init__.py",
line 328, in build_update
    'out of date' % len(to_build))
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx/builders/__init__.py",
line 394, in build
    self.write(docnames, list(updated_docnames), method)
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx/builders/__init__.py",
line 431, in write
    self._write_serial(sorted(docnames))
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx/builders/__init__.py",
line 440, in _write_serial
    self.write_doc(docname, doctree)
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx/builders/html.py",
line 556, in write_doc
    self.handle_page(docname, ctx, event_arg=doctree)
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx/builders/html.py",
line 940, in handle_page
    output = self.templates.render(templatename, ctx)
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx/jinja2glue.py",
line 176, in render
    return self.environment.get_template(template).render(context)
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/jinja2/environment.py",
line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/jinja2/environment.py",
line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/jinja2/_compat.py",
line 37, in reraise
    raise value.with_traceback(tb)
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx/themes/basic/page.html",
line 10, in top-level template code
    {%- extends "layout.html" %}
  File "/usr/local/src/pcav/faunalia-website/_templates/layout.html",
line 39, in top-level template code
    {% block languageswitch %}
  File
"/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx_bootstrap_theme/bootstrap/layout.html",
line 40, in top-level template code
    {% set css_files = css_files + theme_css_files +
bootswatch_css_custom %}
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
>
/usr/local/src/py3_virtual/lib/python3.5/site-packages/sphinx_bootstrap_theme/bootstrap/layout.html(40)top-level
template code()
-> {% set css_files = css_files + theme_css_files + bootswatch_css_custom %}
staffan-einarsson commented 7 years ago

I'm getting something very similar when building HTML.

New python executable in /[...]/.venv-build-docs/bin/python2.7
Also creating executable in /[...]/.venv-build-docs/bin/python
Installing setuptools, pip, wheel...done.
Collecting sphinx
  Downloading Sphinx-1.6.1-py2.py3-none-any.whl (1.9MB)
    100% |████████████████████████████████| 1.9MB 592kB/s 
Collecting sphinx-rtd-theme
  Using cached sphinx_rtd_theme-0.2.4-py2.py3-none-any.whl
Collecting imagesize (from sphinx)
  Using cached imagesize-0.7.1-py2.py3-none-any.whl
Requirement already up-to-date: six>=1.5 in ./.venv-build-docs/lib/python2.7/site-packages (from sphinx)
Collecting Pygments>=2.0 (from sphinx)
  Using cached Pygments-2.2.0-py2.py3-none-any.whl
Collecting sphinxcontrib-websupport (from sphinx)
  Downloading sphinxcontrib_websupport-1.0.1-py2.py3-none-any.whl
Collecting alabaster<0.8,>=0.7 (from sphinx)
  Using cached alabaster-0.7.10-py2.py3-none-any.whl
Collecting snowballstemmer>=1.1 (from sphinx)
  Using cached snowballstemmer-1.2.1-py2.py3-none-any.whl
Collecting docutils>=0.11 (from sphinx)
  Using cached docutils-0.13.1-py2-none-any.whl
Collecting typing (from sphinx)
  Downloading typing-3.6.1.tar.gz (66kB)
    100% |████████████████████████████████| 71kB 5.5MB/s 
Collecting babel!=2.0,>=1.3 (from sphinx)
  Using cached Babel-2.4.0-py2.py3-none-any.whl
Collecting requests>=2.0.0 (from sphinx)
  Downloading requests-2.14.2-py2.py3-none-any.whl (560kB)
    100% |████████████████████████████████| 563kB 1.8MB/s 
Requirement already up-to-date: setuptools in ./.venv-build-docs/lib/python2.7/site-packages (from sphinx)
Collecting Jinja2>=2.3 (from sphinx)
  Using cached Jinja2-2.9.6-py2.py3-none-any.whl
Collecting pytz>=0a (from babel!=2.0,>=1.3->sphinx)
  Using cached pytz-2017.2-py2.py3-none-any.whl
Requirement already up-to-date: packaging>=16.8 in ./.venv-build-docs/lib/python2.7/site-packages (from setuptools->sphinx)
Requirement already up-to-date: appdirs>=1.4.0 in ./.venv-build-docs/lib/python2.7/site-packages (from setuptools->sphinx)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.3->sphinx)
Requirement already up-to-date: pyparsing in ./.venv-build-docs/lib/python2.7/site-packages (from packaging>=16.8->setuptools->sphinx)
Building wheels for collected packages: typing
  Running setup.py bdist_wheel for typing ... done
  Stored in directory: /Users/staffan.einarsson/Library/Caches/pip/wheels/b3/54/d1/d7ad0895b6f57c608afdf3ec5d2339c5d18ffcf2c2e0e0d9aa
Successfully built typing
Installing collected packages: imagesize, Pygments, sphinxcontrib-websupport, alabaster, snowballstemmer, docutils, typing, pytz, babel, requests, MarkupSafe, Jinja2, sphinx, sphinx-rtd-theme
Successfully installed Jinja2-2.9.6 MarkupSafe-1.0 Pygments-2.2.0 alabaster-0.7.10 babel-2.4.0 docutils-0.13.1 imagesize-0.7.1 pytz-2017.2 requests-2.14.2 snowballstemmer-1.2.1 sphinx-1.6.1 sphinx-rtd-theme-0.2.4 sphinxcontrib-websupport-1.0.1 typing-3.6.1
rm -rf build/*
sphinx-build -b html -d build/doctrees   src build/html
Running Sphinx v1.6.1
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 49 source files that are out of date
updating environment: 49 added, 0 changed, 0 removed
reading sources... [100%] rnotes                                                                                                                                                                            

[...]

looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [  2%] api/apidoc                                                                                                                                                                         
Exception occurred:
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx_rtd_theme/layout.html", line 45, in top-level template code
    {% for cssfile in css_files %}
TypeError: 'NoneType' object is not iterable
The full traceback has been saved in /var/folders/p3/5jj6nq1j34lfk_q3882rbppr0000gn/T/sphinx-err-ZNs48p.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!
make: *** [html] Error 1
# Sphinx version: 1.6.1
# Python version: 2.7.13 (CPython)
# Docutils version: 0.13.1 release
# Jinja2 version: 2.9.6
# Last messages:
#   
#   looking for now-outdated files...
#   none found
#   pickling environment...
#   done
#   checking consistency...
#   done
#   preparing documents...
#   done
#   writing output... [  2%] api/apidoc
# Loaded extensions:
#   sphinx.ext.autodoc (1.6.1) from /[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/ext/autodoc.pyc
#   alabaster (0.7.10) from /[...]/.venv-build-docs/lib/python2.7/site-packages/alabaster/__init__.pyc
#   sphinx.ext.githubpages (1.6.1) from /[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/ext/githubpages.pyc
Traceback (most recent call last):
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/cmdline.py", line 306, in main
    app.build(opts.force_all, filenames)
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/application.py", line 338, in build
    self.builder.build_update()
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 328, in build_update
    'out of date' % len(to_build))
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 394, in build
    self.write(docnames, list(updated_docnames), method)
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 431, in write
    self._write_serial(sorted(docnames))
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 440, in _write_serial
    self.write_doc(docname, doctree)
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/builders/html.py", line 556, in write_doc
    self.handle_page(docname, ctx, event_arg=doctree)
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/builders/html.py", line 940, in handle_page
    output = self.templates.render(templatename, ctx)
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/jinja2glue.py", line 176, in render
    return self.environment.get_template(template).render(context)
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx/themes/basic/page.html", line 10, in top-level template code
    {%- extends "layout.html" %}
  File "/[...]/doc/src/_templates/layout.html", line 2, in top-level template code
    {% set css_files = css_files + ["_static/myStyle.css"] %}
  File "/[...]/.venv-build-docs/lib/python2.7/site-packages/sphinx_rtd_theme/layout.html", line 45, in top-level template code
    {% for cssfile in css_files %}
TypeError: 'NoneType' object is not iterable
ulsa commented 7 years ago

I have a similar problem:

# Sphinx version: 1.6.1
# Python version: 2.7.13 (CPython)
# Docutils version: 0.13.1 release
# Jinja2 version: 2.9.6
...
  File ".../lib/python2.7/site-packages/sphinx/themes/basic/../basic/layout.html", line 108, in template
    {%- for css in css_files %}
TypeError: 'NoneType' object is not iterable

Is the problem that nothing sets css_files?

tk0miya commented 7 years ago

Fixed at 62614af. Could you check this please if possible?

ulsa commented 7 years ago

One workaround is to install sphinx==1.5.6.

zapme commented 7 years ago

Checked, works for me.

pcav commented 7 years ago

Confirmed. Thanks.

theacodes commented 7 years ago

Any idea when this will be released? It's currently breaking the build for packaging.python.org. (I'm going to pin to 1.5.6 in the meantime)

tk0miya commented 7 years ago

I'm very sorry. Now I don't have enough time for new release. It might be at this weekend.

theacodes commented 7 years ago

@tk0miya no worries, just wanted a general idea. :)