Sphinx fails due to multiple references to one node

Erik Tollerud avatarErik Tollerud created an issue

When I run sphinx on my docs, everything's fine until the writing stage, when I see the traceback I've included below. These docs worked fine in 1.0 beta 2, but in 1.0.1 they fail. (if you want to test with my source, just get the development version from the directions at http://packages.python.org/Astropysics/ and try "setup.py build_sphinx")

As far as I can tell, the source of the problem is that when trying to resolve references (resolve_references in environment.py), sphinx for some reason visits a particular text node twice, so when it tries to replace it a second time, there's nothing to replace because it's already been replaced.

Traceback (most recent call last):
  File "setup.py", line 92, in <module>
    cmdclass = cmdclassd
  File "/usr/lib/python2.6/distutils/core.py", line 152, in setup
  File "/usr/lib/python2.6/distutils/dist.py", line 975, in run_commands
  File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
  File "/usr/local/lib/python2.6/dist-packages/Sphinx-1.0.1-py2.6.egg/sphinx/setup_command.py", line 141, in run
  File "/usr/local/lib/python2.6/dist-packages/Sphinx-1.0.1-py2.6.egg/sphinx/builders/__init__.py", line 161, in build_all
    self.build(None, summary='all source files', method='all')
  File "/usr/local/lib/python2.6/dist-packages/Sphinx-1.0.1-py2.6.egg/sphinx/builders/__init__.py", line 254, in build
    self.write(docnames, list(updated_docnames), method)
  File "/usr/local/lib/python2.6/dist-packages/Sphinx-1.0.1-py2.6.egg/sphinx/builders/__init__.py", line 292, in write
    doctree = self.env.get_and_resolve_doctree(docname, self)
  File "/usr/local/lib/python2.6/dist-packages/Sphinx-1.0.1-py2.6.egg/sphinx/environment.py", line 1108, in get_and_resolve_doctree
    self.resolve_references(doctree, docname, builder)
  File "/usr/local/lib/python2.6/dist-packages/Sphinx-1.0.1-py2.6.egg/sphinx/environment.py", line 1327, in resolve_references
    node.replace_self(newnode or contnode)
  File "/usr/local/lib/python2.6/dist-packages/docutils/nodes.py", line 693, in replace_self
    self.parent.replace(self, new)
  File "/usr/local/lib/python2.6/dist-packages/docutils/nodes.py", line 666, in replace
    index = self.index(old)
  File "/usr/local/lib/python2.6/dist-packages/docutils/nodes.py", line 641, in index
    return self.children.index(item)
ValueError: list.index(x): x not in list

Comments (2)

  1. Georg Brandl

    The main problem is that in your source file, you have :type a1: and :type a2: twice for the coords.funcs.match_coords function. Of course, that shouldn't cause a crash in Sphinx, so I've added a fix for this in 7a4d83988d7e .

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.