Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'dict' object has no attribute '__module__' #9213

Closed
vrtulka23 opened this issue May 11, 2021 · 4 comments
Closed

'dict' object has no attribute '__module__' #9213

vrtulka23 opened this issue May 11, 2021 · 4 comments
Labels

Comments

@vrtulka23
Copy link

vrtulka23 commented May 11, 2021

Hello, I encountered the following error:

# Sphinx version: 3.4.1
# Python version: 3.9.1 (CPython)
# Docutils version: 0.16 release
# Jinja2 version: 2.11.2
# Last messages:
#   Running Sphinx v3.4.1
#   making output directory...
#   done
#   building [mo]: targets for 0 po files that are out of date
#   building [html]: targets for 34 source files that are out of date
#   updating environment:
#   [new config]
#   34 added, 0 changed, 0 removed
#   reading sources... [  2%] api/microservice
#   reading sources... [  5%] api/servicetemplate
# Loaded extensions:
#   sphinx.ext.mathjax (3.4.1) from /usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/ext/mathjax.py
#   sphinxcontrib.applehelp (1.0.2) from /usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinxcontrib/applehelp/__init__.py
#   sphinxcontrib.devhelp (1.0.2) from /usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinxcontrib/devhelp/__init__.py
#   sphinxcontrib.htmlhelp (1.0.3) from /usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinxcontrib/htmlhelp/__init__.py
#   sphinxcontrib.serializinghtml (1.1.4) from /usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinxcontrib/serializinghtml/__init__.py
#   sphinxcontrib.qthelp (1.0.3) from /usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinxcontrib/qthelp/__init__.py
#   alabaster (0.7.12) from /usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/alabaster/__init__.py
#   sphinx.ext.autodoc.type_comment (3.4.1) from /usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/ext/autodoc/type_comment.py
#   sphinx.ext.autodoc (3.4.1) from /usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/ext/autodoc/__init__.py
Traceback (most recent call last):
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/cmd/build.py", line 280, in build_main
    app.build(args.force_all, filenames)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/application.py", line 352, in build
    self.builder.build_update()
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 296, in build_update
    self.build(to_build,
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 310, in build
    updated_docnames = set(self.read())
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 417, in read
    self._read_serial(docnames)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 438, in _read_serial
    self.read_doc(docname)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 478, in read_doc
    doctree = read_doc(self.app, self.env, self.env.doc2path(docname))
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/io.py", line 221, in read_doc
    pub.publish()
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/core.py", line 217, in publish
    self.document = self.reader.read(self.source, self.parser,
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/io.py", line 126, in read
    self.parse()
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/readers/__init__.py", line 77, in parse
    self.parser.parse(self.input, document)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/parsers.py", line 104, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 170, in run
    results = StateMachineWS.run(self, input_lines, input_offset,
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/statemachine.py", line 241, in run
    context, next_state, result = self.check_line(
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/statemachine.py", line 459, in check_line
    return method(match, context, next_state)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 2769, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 393, in new_subsection
    newabsoffset = self.nested_parse(
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 281, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/statemachine.py", line 241, in run
    context, next_state, result = self.check_line(
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/statemachine.py", line 459, in check_line
    return method(match, context, next_state)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 2769, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 393, in new_subsection
    newabsoffset = self.nested_parse(
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 281, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/statemachine.py", line 241, in run
    context, next_state, result = self.check_line(
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/statemachine.py", line 459, in check_line
    return method(match, context, next_state)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 2769, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 393, in new_subsection
    newabsoffset = self.nested_parse(
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 281, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/statemachine.py", line 241, in run
    context, next_state, result = self.check_line(
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/statemachine.py", line 459, in check_line
    return method(match, context, next_state)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 2342, in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 2354, in explicit_construct
    return method(self, expmatch)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 2096, in directive
    return self.run_directive(
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/docutils/parsers/rst/states.py", line 2146, in run_directive
    result = directive_instance.run()
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/ext/autodoc/directive.py", line 146, in run
    documenter.generate(more_content=self.content)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/ext/autodoc/__init__.py", line 1682, in generate
    return super().generate(more_content=more_content,
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/ext/autodoc/__init__.py", line 956, in generate
    self.add_content(more_content)
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/ext/autodoc/__init__.py", line 1665, in add_content
    more_content = StringList([_('alias of %s') % restify(self.object)], source='')
  File "/usr/local/Cellar/sphinx-doc/3.4.1/libexec/lib/python3.9/site-packages/sphinx/util/typing.py", line 99, in restify
    elif cls.__module__ in ('__builtin__', 'builtins'):
AttributeError: 'dict' object has no attribute '__module__'
@tk0miya
Copy link
Member

tk0miya commented May 11, 2021

Sorry, I can't understand what happened from this log. And I can't reproduce the error because no info. It would be nice if you post additional info to reproduce the error (Please don't ignore our issue template!). Thanks,

@tk0miya tk0miya closed this as completed May 11, 2021
@jantman
Copy link

jantman commented May 14, 2021

I'm seeing a very similar error (same exact line, except I have a str instead of a dict). Sphinx 4.0.1, using sphinx-apidoc.

I'll try digging into this later today, but I have a strong suspicion that this is related to my use of type annotations, typing.TYPE_CHECKING to prevent circular imports, and/or __future__.annotations for postponed evaluation of annotations.

@tk0miya
Copy link
Member

tk0miya commented May 15, 2021

@jantman I guess your case is similar to this but different. Please file a new issue if you can reproduce the error.

@jantman
Copy link

jantman commented May 18, 2021

I've opened #9245 which I believe is the same bug.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants