当我尝试为我导入的模块制作文档时,Sphinx 会引发此错误from google.appengine.ext import ndb
:
Traceback (most recent call last):e/adapters
File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.1.3-py2.7.egg/sphinx/ext/autodoc.py", line 321, in import_object
__import__(self.modname)
File "/home/peto/workspace/mymodule.py", line 11, in <module>
from google.appengine.ext import ndb
File "/usr/lib/pymodules/python2.7/google/appengine/ext/ndb/__init__.py", line 7, in <module>
from tasklets import *
File "/usr/lib/pymodules/python2.7/google/appengine/ext/ndb/tasklets.py", line 68, in <module>
from .google_imports import apiproxy_stub_map
File "/usr/lib/pymodules/python2.7/google/appengine/ext/ndb/google_imports.py", line 33, in <module>
from google.appengine.ext import gql
ImportError: cannot import name gql
我yaml
通过将它包含在之前解决了同样的问题,sys.path
但它不适用于gql
. 我的conf.py
配置是这样的:
gae_path = '/usr/lib/google-app-engine'
sys.path[0:0] = [
gae_path,
os.path.join(gae_path, 'lib'),
os.path.join(gae_path, 'lib', 'yaml'),
os.path.join(gae_path, 'lib', 'yaml', 'lib'),
os.path.join(gae_path, 'google'),
os.path.join(gae_path, 'google', 'appengine'),
os.path.join(gae_path, 'google', 'appengine', 'ext'),
os.path.join(gae_path, 'google', 'appengine', 'ext', 'gql'), # The gql package is really there
os.path.abspath('../../'),
]