Google应用引擎SDK已安装到:/usr/local/google_appengine
以下是我的脚本:
#!/usr/bin/python
# coding=utf8
import os, sys
p = '/usr/local/google_appengine'
if p not in sys.path:
sys.path.append(p)
import dev_appserver
dev_appserver.fix_sys_path()
GAE_USER = '*hide*'
GAE_PASS = '*hide*'
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.ext import ndb
from google.appengine.api import search, memcache
Traceback (most recent call last):
File "./mkiniGAE.py", line 15, in <module>
from google.appengine.ext.remote_api import remote_api_stub
ImportError: No module named appengine.ext.remote_api
有什么问题?
答案 0 :(得分:0)
我必须添加此行才能使其正常工作:
if 'google' in sys.modules:
del sys.modules['google']
还需要添加&#39; fancy_urlib&#39;路径:
sys.path.append(os.path.join(p, 'lib', 'fancy_urllib'))
所以最终的代码看起来应该是这样的:
import os, sys
GAE_PATH = '/usr/local/google_appengine'
if 'google' in sys.modules:
del sys.modules['google']
EXTRA_PATHS = [
GAE_PATH,
os.path.join(GAE_PATH, 'lib', 'fancy_urllib'),
]
if 'google' in sys.modules:
del sys.modules['google']
for path in EXTRA_PATHS:
sys.path.append(path)
from google.appengine.ext.remote_api import remote_api_stub