简体   繁体   中英

“No module named” several import errors in Python Sphinx

I am new to sphinx documentation. I followed the sphinx documentation for configuring sphinx for my cherrypy project.But when I run make html it throws me lots of errors and warnings as follows:

Traceback (most recent call last):.root                                                                                                                                                         
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.root.urls
Traceback (most recent call last):
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.root.views
Traceback (most recent call last):.search                                                                                                                                                       
 File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in       import_object                                                                  
__import__(self.modname)                                                                                                                                                                    
ImportError: No module named myproject.apps.search.searchBll                                                                                                                                          
Traceback (most recent call last):                                                                                                                                                              
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object                                                                  
__import__(self.modname)                                                                                                                                                                    
ImportError: No module named myproject.apps.search.searchDal                                                                                                                                          
Traceback (most recent call last):
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.search.urls
Traceback (most recent call last):
File "workspace/myproject-virtualenv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
ImportError: No module named myproject.apps.search.views
.
.
.
workspace/myproject/docs/api_doc/source/myproject.apps.root.rst:7: WARNING: autodoc can't   import/find module 'myproject.apps.root.urls', it reported error: "No module named myproject.apps.root.urls", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.root.rst:15: WARNING: autodoc can't import/find module 'myproject.apps.root.views', it reported error: "No module named myproject.apps.root.views", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:7: WARNING: autodoc can't import/find module 'myproject.apps.search.searchBll', it reported error: "No module named myproject.apps.search.searchBll", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:15: WARNING: autodoc can't import/find module 'myproject.apps.search.searchDal', it reported error: "No module named myproject.apps.search.searchDal", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:23: WARNING: autodoc can't import/find module 'myproject.apps.search.urls', it reported error: "No module named myproject.apps.search.urls", please check your spelling and sys.path
workspace/myproject/docs/api_doc/source/myproject.apps.search.rst:31: WARNING: autodoc can't import/find module 'myproject.apps.search.views', it reported error: "No module named myproject.apps.search.views", please check your spelling and sys.path

looking for now-outdated files... none found
pickling environment... done
checking consistency... workspace/myproject/docs/api_doc/source/modules.rst::       WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%]   modules                                                                                                                                                                
writing additional files... (0 module code pages) genindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 21 warnings.

Build finished. The HTML pages are in build/html.

Any hope ? someone please help.. I have also changed the line in my conf.py as follows:

sys.path.append('workspace/myproject/src/myproject/')

myproject is a module. You have thus to add its parent container to the PYTHONPATH (and not the myproject-folder itself):

sys.path.append('workspace/myproject/src/')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM