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

Build broken due to TypeError: 'generator' object is not subscriptable #9788

Closed
m4sterbunny opened this issue Oct 28, 2021 · 11 comments
Closed

Comments

@m4sterbunny
Copy link

Describe the bug

This built fine locally for me.

When I tried to force a build from your interface this Exception occurred:
File "/home/docs/checkouts/readthedocs.org/user_builds/demo-zoom/envs/latest/lib/python3.7/site-packages/sphinx/builders/latex/init.py", line 201, in write
if toctrees[0].get('maxdepth') > 0:
TypeError: 'generator' object is not subscriptable

How to Reproduce

git clone --no-single-branch --depth 50 https://github.com/m4sterbunny/Demo.git .
git checkout --force origin/master
git clean -d -f -f
python3.7 -mvirtualenv /home/docs/checkouts/readthedocs.org/user_builds/demo-zoom/envs/latest
/home/docs/checkouts/readthedocs.org/user_builds/demo-zoom/envs/latest/bin/python -m pip install --upgrade --no-cache-dir pip setuptools
/home/docs/checkouts/readthedocs.org/user_builds/demo-zoom/envs/latest/bin/python -m pip install --upgrade --no-cache-dir mock==1.0.1 pillow==5.4.1 alabaster>=0.7,<0.8,!=0.7.5 commonmark==0.8.1 recommonmark==0.5.0 sphinx<2 sphinx-rtd-theme<0.5 readthedocs-sphinx-ext<2.2
cat source/conf.py
/home/docs/checkouts/readthedocs.org/user_builds/demo-zoom/envs/latest/bin/python -m sphinx -T -b html -d _build/doctrees -D language=en . _build/html
/home/docs/checkouts/readthedocs.org/user_builds/demo-zoom/envs/latest/bin/python -m sphinx -T -b readthedocssinglehtmllocalmedia -d _build/doctrees -D language=en . _build/localmedia
/home/docs/checkouts/readthedocs.org/user_builds/demo-zoom/envs/latest/bin/python -m sphinx -b latex -D language=en -d _build/doctrees . _build/latex
Running Sphinx v1.8.5
loading translations [en]... done
making output directory...
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [latex]: all documents
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
processing Showcasing.tex...
Exception occurred:
File "/home/docs/checkouts/readthedocs.org/user_builds/demo-zoom/envs/latest/lib/python3.7/site-packages/sphinx/builders/latex/init.py", line 201, in write
if toctrees[0].get('maxdepth') > 0:
TypeError: 'generator' object is not subscriptable
The full traceback has been saved in /tmp/sphinx-err-omlwgho4.log,

Expected behavior

This built fine locally. I expected you to build it too!
Outputs here: https://demo-zoom.readthedocs.io/en/latest/pages/

Your project

https://readthedocs.org/projects/demo-zoom

Screenshots

No response

OS

Win 10 with Ubuntu

Python version

Python 3

Sphinx version

How do I even get that Sphinx -v does not work, nor variants of

Sphinx extensions

No response

Extra tools

No response

Additional context

Works for me locally. What's up?

@astrojuanlu
Copy link
Contributor

Similar to #9727, pin docutils<0.18 in your requirements.

@astrojuanlu
Copy link
Contributor

See also readthedocs/readthedocs.org#8616.

@m4sterbunny
Copy link
Author

Tried to follow the docs, but despite specifying which Sphinx -- locally and remotely I seem to be on 1.8.5:
image

vbarbaresi added a commit to vbarbaresi/trafilatura that referenced this issue Oct 28, 2021
Sphinx build was failing because of this issue sphinx-doc/sphinx#9788

Pinning docutils seems easier than upgrading Sphinx from 1.8 to > 4.0

In the future you might want to look into upgrading Sphinx
@astrojuanlu
Copy link
Contributor

The .readthedocs.yaml file should be at the root of the repository, please try moving it

@peterjc
Copy link
Contributor

peterjc commented Oct 28, 2021

Just noticed this started 2 or 3 days ago for me on RTD:
https://readthedocs.org/projects/thapbi-pict/builds/

Exception occurred:
  File "/home/docs/checkouts/readthedocs.org/user_builds/thapbi-pict/envs/latest/lib/python3.7/site-packages/sphinx/builders/latex/__init__.py", line 201, in write
    if toctrees[0].get('maxdepth') > 0:
TypeError: 'generator' object is not subscriptable

Good:
Jinja2-3.0.2 MarkupSafe-2.0.1 Pygments-2.10.0 alabaster-0.7.12 babel-2.9.1 certifi-2021.10.8 charset-normalizer-2.0.7 commonmark-0.8.1 docutils-0.17.1 future-0.18.2 idna-3.3 imagesize-1.2.0 mock-1.0.1 packaging-21.0 pillow-5.4.1 pyparsing-3.0.1 pytz-2021.3 readthedocs-sphinx-ext-2.1.4 recommonmark-0.5.0 requests-2.26.0 six-1.16.0 snowballstemmer-2.1.0 sphinx-1.8.5 sphinx-rtd-theme-0.4.3 sphinxcontrib-serializinghtml-1.1.5 sphinxcontrib-websupport-1.2.4 urllib3-1.26.7

Bad:
Jinja2-3.0.2 MarkupSafe-2.0.1 Pygments-2.10.0 alabaster-0.7.12 babel-2.9.1 certifi-2021.10.8 charset-normalizer-2.0.7 commonmark-0.8.1 docutils-0.18 future-0.18.2 idna-3.3 imagesize-1.2.0 mock-1.0.1 packaging-21.0 pillow-5.4.1 pyparsing-3.0.3 pytz-2021.3 readthedocs-sphinx-ext-2.1.4 recommonmark-0.5.0 requests-2.26.0 six-1.16.0 snowballstemmer-2.1.0 sphinx-1.8.5 sphinx-rtd-theme-0.4.3 sphinxcontrib-serializinghtml-1.1.5 sphinxcontrib-websupport-1.2.4 urllib3-1.26.7

i.e. Updated from docutils-0.17.1 (working) to docutils-0.18 (broken)

@m4sterbunny
Copy link
Author

I had tried that in my wanderings in the wilderness; but to no effect:

image

@astrojuanlu
Copy link
Contributor

@m4sterbunny You didn't move your .readthedocs.yaml file yet, or at least I don't see it in your demo project. If you do, please link to the corresponding build or commit.

@peterjc Yes, this is caused by docutils 0.18, see the linked issues in my comments above.

@m4sterbunny
Copy link
Author

OK -- so I pushed rather than just looking local. Interestingly I am now getting different Sphinx version locally compared to your Build:
image

@m4sterbunny
Copy link
Author

m4sterbunny commented Oct 29, 2021

But the RtD build fails with a new error (whereas local build completes):
[https://readthedocs.org/projects/demo-zoom/builds/15124864/]

Sphinx error:
master file /home/docs/checkouts/readthedocs.org/user_builds/demo-zoom/checkouts/latest/index.rst not found

mattbennett added a commit to nameko/nameko that referenced this issue Oct 29, 2021
mattbennett added a commit to nameko/nameko that referenced this issue Oct 29, 2021
mattbennett added a commit to nameko/nameko that referenced this issue Oct 29, 2021
@astrojuanlu
Copy link
Contributor

@m4sterbunny The .readthedocs.yaml file is only used by Read the Docs, it has no effect locally.

I see that the generator problem was solved after moving the config file to the root of the repository. Please open another issue with the current problem.

@astrojuanlu
Copy link
Contributor

Also, notice that Sphinx and Read the Docs have separate issue trackers. The former is this one, the latter is https://github.com/readthedocs/readthedocs.org/issues/. If your problem is with Sphinx it should be here, if it's with Read the Docs it should be there.

@tk0miya tk0miya closed this as completed Oct 29, 2021
cmhughes referenced this issue in cmhughes/latexindent.pl Oct 31, 2021
docutils<0.18 attempt
sigmavirus24 added a commit to sigmavirus24/github3.py that referenced this issue Nov 1, 2021
elahrvivaz added a commit to elahrvivaz/geomesa that referenced this issue Nov 1, 2021
a0x8o added a commit to a0x8o/geomesa that referenced this issue Nov 1, 2021
sigmavirus24 added a commit to PyCQA/flake8 that referenced this issue Nov 2, 2021
docutils 0.18 is busted and needs to be prevented from being installed

Related to sphinx-doc/sphinx#9788

Related to readthedocs/readthedocs.org#8616
rgommers added a commit to rgommers/pywt that referenced this issue Nov 6, 2021
This is the workaround for sphinx-doc/sphinx#9788

Also update the intersphinx link for NumPy. NumPy moved away from
docs.scipy.org quite a while ago. Pointing to numpy.org/devdocs
matches what SciPy does.
shirubana added a commit to NREL/bifacial_radiance that referenced this issue Nov 9, 2021
davidhalter added a commit to davidhalter/jedi that referenced this issue Nov 17, 2021
Docs were not building on read the docs, see also: sphinx-doc/sphinx#9788
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 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

4 participants