Skip to content

TypeError: 'generator' object is not reversible #9727

Closed

Description

@ugiwgh

Describe the bug

My cmd:
/usr/local/bin/sphinx-build -b man -t man -d /root/bu/ceph/build/doc/doctrees -c /root/bu/ceph/man /root/bu/ceph/doc/man /root/bu/ceph/build/doc/man

Error Message:
Running Sphinx v1.7.6
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: 46 added, 0 changed, 0 removed
reading sources... [ 2%] 8/ceph
reading sources... [ 4%] 8/ceph-authtool
reading sources... [ 6%] 8/ceph-bluestore-tool

Exception occurred:
File "/usr/local/Python-3.6.15/lib/python3.6/site-packages/Sphinx-1.7.6.dev20211011-py3.6.egg/sphinx/util/nodes.py", line 57, in apply_source_workaround
for classifier in reversed(node.parent.traverse(nodes.classifier)):
TypeError: 'generator' object is not reversible
The full traceback has been saved in /tmp/sphinx-err-jpnnyy28.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!

How to Reproduce

I download the sphinx from https://github.com/sphinx-doc/sphinx.
And build it with "python3 setup.py install".

Expected behavior

No response

Your project

https://github.com/ceph/ceph

Screenshots

No response

OS

CentOS Linux release 7.9.2009 (Core)

Python version

Python 3.6.15

Sphinx version

sphinx-1.7.6.tar.gz

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

Activity

  1. throneofshadow commented on Oct 26, 2021

    @throneofshadow

    Have this error as well.

    Running Sphinx v1.8.5
    loading translations [en]... done
    making output directory...
    building [mo]: targets for 0 po files that are out of date
    building [html]: targets for 15 source files that are out of date
    updating environment: 15 added, 0 changed, 0 removed
    reading sources... [ 6%] hardware/hardware
    reading sources... [ 13%] index

    Traceback (most recent call last):
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 304, in build_main
    app.build(args.force_all, filenames)
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 341, in build
    self.builder.build_update()
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/builders/init.py", line 347, in build_update
    len(to_build))
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/builders/init.py", line 360, in build
    updated_docnames = set(self.read())
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/builders/init.py", line 468, in read
    self._read_serial(docnames)
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/builders/init.py", line 490, in _read_serial
    self.read_doc(docname)
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/builders/init.py", line 534, in read_doc
    doctree = read_doc(self.app, self.env, self.env.doc2path(docname))
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/io.py", line 318, in read_doc
    pub.publish()
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/docutils/core.py", line 219, in publish
    self.apply_transforms()
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/docutils/core.py", line 200, in apply_transforms
    self.document.transformer.apply_transforms()
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/transforms/init.py", line 90, in apply_transforms
    Transformer.apply_transforms(self)
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/docutils/transforms/init.py", line 171, in apply_transforms
    transform.apply(**kwargs)
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/transforms/init.py", line 245, in apply
    apply_source_workaround(n)
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/util/nodes.py", line 94, in apply_source_workaround
    for classifier in reversed(node.parent.traverse(nodes.classifier)):
    TypeError: 'generator' object is not reversible

    Exception occurred:
    File "/home/docs/checkouts/readthedocs.org/user_builds/reachmaster/envs/latest/lib/python3.7/site-packages/sphinx/util/nodes.py", line 94, in apply_source_workaround
    for classifier in reversed(node.parent.traverse(nodes.classifier)):
    TypeError: 'generator' object is not reversible
    The full traceback has been saved in /tmp/sphinx-err-u2codvq0.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!

  2. andrewegel commented on Oct 26, 2021

    @andrewegel

    I encountered this in my own way. Check your version of docutils thats being utilized here. There was a recent docutils-0.18 release that made a note of this change: https://docutils.sourceforge.io/RELEASE-NOTES.html#release-0-18-2021-10-26

    nodes.Node.traverse() returns an iterator instead of a list.
    

    Pinning docutils==0.17.1 resolved this issue for us.

  3. pohmelie commented on Oct 26, 2021

    @pohmelie
  4. astrojuanlu commented on Oct 26, 2021

    @astrojuanlu
    Contributor

    Hi @pohmelie , Juan Luis from Read the Docs here - that's to be expected, pin your docutils version to <0.18

  5. throneofshadow commented on Oct 26, 2021

    @throneofshadow

    Pinning docutils to <0.18 works!!! Thanks everyone!

  6. added a commit that references this issue on Oct 27, 2021
  7. JohnPaton commented on Oct 27, 2021

    @JohnPaton

    Shouldn't Sphinx change its own requirements to include docutils<0.18 in this case?

  8. pohmelie commented on Oct 27, 2021

    @pohmelie
  9. added a commit that references this issue on Oct 27, 2021
  10. cirospat commented on Oct 27, 2021

    @cirospat

    thanks you for your replies.
    Problem solved.

    pin docutils<0.18
    in your requirements.txt file,
    and have a .readthedocs.yaml file with these contents:

    version: 2
    python:
       install:
       - requirements: docs/requirements.txt
    

    as reported by @astrojuanlu
    here: readthedocs/readthedocs.org#8616 (comment)

    I followed this instruction and it works! Build succes

  11. tk0miya commented on Oct 27, 2021

    @tk0miya
    Member

    The recommended way is upgrading Sphinx to the latest one. It has already pinned the version of docutils. I think no reason to keep using the old version of Sphinx. Let's upgrade!

  12. pinned this issue on Oct 27, 2021
  13. 17 remaining items

  14. added a commit that references this issue on Nov 4, 2021
  15. added a commit that references this issue on Nov 4, 2021
  16. added a commit that references this issue on Nov 4, 2021
  17. added a commit that references this issue on Nov 4, 2021
  18. added a commit that references this issue on Nov 9, 2021
  19. added a commit that references this issue on Nov 16, 2021
  20. added a commit that references this issue on Nov 17, 2021
  21. locked as resolved and limited conversation to collaborators on Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions