1

当我尝试为我导入的模块制作文档时,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('../../'),
]
4

1 回答 1

2

问题是我的sys.path另一个谷歌包里/usr/lib/pymodules/python2.7/google/appengine没有ext.gql包。我删除了那个文件夹,它就像一个魅力。

于 2013-02-15T15:41:17.340 回答