TypeError when creating links from gallery to documentation
See original GitHub issueI’m using the excellent sphinx-gallery extension in my python project py-pde
. The documentation is hosted on readthedocs and things worked perfectly until very recently. Since a few days every documentation build fails with the following traceback:
[...]
copying static files... done
copying readthedocs static files... done
copying searchtools... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 3 warnings.
The HTML pages are in _build/html.
Sphinx-gallery successfully executed 0 out of 0 files subselected by:
gallery_conf["filename_pattern"] = '/'
gallery_conf["ignore_pattern"] = '.*movie.*'
after excluding 16 files that had previously been run (based on MD5).
embedding documentation hyperlinks...
embedding documentation hyperlinks for examples_gallery... [ 5%] simple.html
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/py-pde/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/py-pde/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 369, in build
self.emit('build-finished', None)
File "/home/docs/checkouts/readthedocs.org/user_builds/py-pde/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 510, in emit
return self.events.emit(event, self, *args)
File "/home/docs/checkouts/readthedocs.org/user_builds/py-pde/envs/latest/lib/python3.7/site-packages/sphinx/events.py", line 80, in emit
results.append(callback(*args))
File "/home/docs/checkouts/readthedocs.org/user_builds/py-pde/envs/latest/lib/python3.7/site-packages/sphinx_gallery/docs_resolv.py", line 442, in embed_code_links
_embed_code_links(app, gallery_conf, gallery_dir)
File "/home/docs/checkouts/readthedocs.org/user_builds/py-pde/envs/latest/lib/python3.7/site-packages/sphinx_gallery/docs_resolv.py", line 340, in _embed_code_links
for modname in (cobj['module_short'], cobj['module']):
TypeError: string indices must be integers
Exception occurred:
File "/home/docs/checkouts/readthedocs.org/user_builds/py-pde/envs/latest/lib/python3.7/site-packages/sphinx_gallery/docs_resolv.py", line 340, in _embed_code_links
for modname in (cobj['module_short'], cobj['module']):
TypeError: string indices must be integers
The full traceback has been saved in /tmp/sphinx-err-osihz662.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!
The documentation builds without any problem on my own computer, where I sue Sphinx v2.4.4. Readthedocs reports that it uses Sphinx v1.8.5, which is certainly not the newest but should be sufficient per the sphinx-gallery documentation. Is there anything I can do on my side? Do you require more information?
Issue Analytics
- State:
- Created 3 years ago
- Comments:27 (16 by maintainers)
Top Results From Across the Web
Sphinx documentation and links to Markdown - Stack Overflow
...and on running make html I get the following error..... ❱ cat /tmp/sphinx-err-57rejer3.log # Sphinx version: 1.8.0 # Python version: 3.6.
Read more >Unable to create link when wrapping img [#2848535] - Drupal
Module will not save the link if the link is being applied to an image file. The following error appears in console: Uncaught...
Read more >URL.createObjectURL() - Web APIs | MDN
The URL.createObjectURL() static method creates a string containing a URL representing the object given in the parameter.
Read more >Upgrading Your Maps JavaScript API Application from V2 to V3
To verify, check the the URL from which you load the Maps JavaScript API for its key parameter. If the key value starts...
Read more >IO tools (text, CSV, HDF5, …) — pandas 1.5.2 documentation
For examples that use the StringIO class, make sure you import it with from io import StringIO for Python 3. CSV & text...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
example_code_obj
should be a dict of list of dict. For some reason yours is a dict of dict (not embedded within a list). I’m not sure how this could happen from the code:example_code_obj
in the code comes fromidentify_names
:https://github.com/sphinx-gallery/sphinx-gallery/blob/master/sphinx_gallery/gen_rst.py#L809-L813
identify_names
only creates dict of list of dict:https://github.com/sphinx-gallery/sphinx-gallery/blob/master/sphinx_gallery/backreferences.py#L195-L231
This file simply gets loaded and parsed assuming it’s a dict of list of dict:
https://github.com/sphinx-gallery/sphinx-gallery/blob/master/sphinx_gallery/docs_resolv.py#L324-L340
Can you try on the branch from #637, which explicitly checks the types in a couple of places?
I attached it to the email, but it didn’t go through 😃 Here is a zipped version, since GitHub does not like the pickle extension:
spherical_grid_codeobj.pickle.zip