autosummary and Python 3 problem

pbouda avatarpbouda created an issue

I have a problem building a sphinx project with Python 3. The project uses autosummary and the :toctree: directive, an example file is here:

https://raw.github.com/lingpy/lingpy/master/doc/source/docu/compare/trebor.rst

When I try to build the project I get the error:

  File "/usr/local/lib/python3.2/dist-packages/Sphinx-1.2b1-py3.2.egg/sphinx/ext/autosummary/generate.py", line 104, in generate_autosummary_docs
    for name, path, template_name in sorted(items):
TypeError: unorderable types: NoneType() < str()

This seem to be an error related to the "sorted" function in Python 3. In Python 2 everything is fine. The line in "generated.py" is the following:

https://bitbucket.org/birkenfeld/sphinx/src/ef3092d458cc00c4b74dd342ea05ba1059a5da70/sphinx/ext/autosummary/generate.py?at=default#cl-104

The next line 105 indicates that some tuple entries might be "None", so sorting should also work with "None" values. Is this a bug in autosummary?

Best, Peter

Comments (4)

  1. pbouda

    Btw, we fixed this temporarily by replacing line 104 of generate.py with:

    for name, path, template_name in sorted(items,key=lambda x: str(x)):
    

    I am not sure if this is the intended behaviour, but we can then build our documentation also with Python 3.

  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.