Sphinx error on Readthedocs: "TypeError: 'bool' object has no attribute '__getitem__'"

Sphinx error on Readthedocs: "TypeError: 'bool' object has no attribute '__getitem__'"

在 Readthedocs 上构建文档失败,出现一个很难理解的 Sphinx 错误:

Exception occurred:
  File "/home/docs/checkouts/readthedocs.org/user_builds/fluidimage/envs/latest/local/lib/python2.7/site-packages/sphinx/ext/viewcode.py", line 61, in has_tag
  if entry is None or entry[0] != code:
TypeError: 'bool' object has no attribute '__getitem__'

有关完整日志,请参阅 https://readthedocs.org/projects/fluidimage/builds/3758665/

我发现其他项目也遇到过同样的问题 (link to the google search),但这并不能帮助我理解发生了什么。

这个错误是什么意思?如何解决?

所以我的问题的实际答案可以是

  • 等待
  • 几乎什么都不做就提交修改
  • 重新构建...

Sphinx-Readthedocs 错误消失了。至少我是这样。

这个问题似乎与 this sphinx issue 有关。虽然 sphinx 已更新自身以允许将 autodoc_default_options 定义为 True,但可能是 readthedocs 使用的是旧版本的 sphinx 或由于某种原因无法接受这些值。将 autodoc_default_options 字典中的值更改为 None 允许构建继续。

示例:

autodoc_default_options = {
    'members': None, 'undoc-members': None,
    'private-members': None, 'show-inheritance': None
}