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

TypeError from flask import when generating html doc from automodapi #96

Open
seanjkanderson opened this issue Mar 26, 2020 · 0 comments

Comments

@seanjkanderson
Copy link

I am trying to document a routes.py/views.py script for a flask app. However, the build fails on from flask import request. I deduced this by commenting out lines until I isolated this import statement (if there is a better way to debug sphinx commands please let me know). The response:

(opt) Seans-MBP-4:docs seananderson$ sphinx-build -b html . _build
Running Sphinx v2.4.4
/Users/seananderson/Documents/nsr/data_engine/docs
/Users/seananderson/anaconda3/envs/opt/lib/python3.6/site-packages/m2r.py:652: RemovedInSphinx30Warning: app.add_source_parser() does not support suffix argument. Use app.add_source_suffix() instead.
  app.add_source_parser('.md', M2RParser)
loading pickled environment... done

Exception occurred:
  File "/Users/seananderson/anaconda3/envs/opt/lib/python3.6/site-packages/sphinx_automodapi/utils.py", line 99, in find_mod_objs
    fqnames.append(obj.__module__ + '.' + obj.__name__)
TypeError: must be str, not NoneType
The full traceback has been saved in /var/folders/4x/r93csfhd49n5vwksjfxz6m780000gn/T/sphinx-err-d7at05w8.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 log file:

# Sphinx version: 2.4.4
# Python version: 3.6.8 (CPython)
# Docutils version: 0.14
# Jinja2 version: 2.10.3
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
  File "/Users/seananderson/anaconda3/envs/opt/lib/python3.6/site-packages/sphinx/cmd/build.py", line 275, in build_main
    args.tags, args.verbosity, args.jobs, args.keep_going)
  File "/Users/seananderson/anaconda3/envs/opt/lib/python3.6/site-packages/sphinx/application.py", line 278, in __init__
    self._init_builder()
  File "/Users/seananderson/anaconda3/envs/opt/lib/python3.6/site-packages/sphinx/application.py", line 334, in _init_builder
    self.events.emit('builder-inited')
  File "/Users/seananderson/anaconda3/envs/opt/lib/python3.6/site-packages/sphinx/events.py", line 99, in emit
    results.append(callback(self.app, *args))
  File "/Users/seananderson/anaconda3/envs/opt/lib/python3.6/site-packages/sphinx_automodapi/automodsumm.py", line 256, in process_automodsumm_generation
    lines = automodsumm_to_autosummary_lines(sfn, app)
  File "/Users/seananderson/anaconda3/envs/opt/lib/python3.6/site-packages/sphinx_automodapi/automodsumm.py", line 331, in automodsumm_to_autosummary_lines
    filestr = automodapi.automodapi_replace(fr.read(), app, True, docname, False)
  File "/Users/seananderson/anaconda3/envs/opt/lib/python3.6/site-packages/sphinx_automodapi/automodapi.py", line 294, in automodapi_replace
    modnm, toskip, onlylocals=onlylocals)
  File "/Users/seananderson/anaconda3/envs/opt/lib/python3.6/site-packages/sphinx_automodapi/automodapi.py", line 405, in _mod_info
    for localnm, fqnm, obj in zip(*find_mod_objs(modname, onlylocals=onlylocals)):
  File "/Users/seananderson/anaconda3/envs/opt/lib/python3.6/site-packages/sphinx_automodapi/utils.py", line 99, in find_mod_objs
    fqnames.append(obj.__module__ + '.' + obj.__name__)
TypeError: must be str, not NoneType

To Reproduce
Steps to reproduce the behavior:

Given a file:
### test.py
from flask import request

###

### Create a .rst file

===
Title
===

.. toctree::
   :maxdepth: 2
.. automodapi:: test

###

$ sphinx-build -b html . _build

Expected behavior
The documentation is expected to build with a module level summary of the file (test.py would contain an instance of Test() for example)

Environment info

  • OS: [Mac 10.14.6]
  • Python version: [e.g. 3.6.8]
  • Sphinx version: [e.g. 2.4.4]
  • Sphinx extensions: [
    'sphinx.ext.autodoc',
    'sphinx.ext.todo',
    'numpydoc',
    'sphinx_automodapi.automodapi',
    'm2r'
    ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant