我试图使用Boto3来管理GAE应用程序中的一些EC2实例,但是导入Boto3会导致以下错误:
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/Users/squad/Desktop/Squad/Squad/squad.py", line 6, in <module>
from boto3 import Session
File "/Users/squad/Desktop/Squad/Squad/lib/boto3/__init__.py", line 16, in <module>
from boto3.session import Session
File "/Users/squad/Desktop/Squad/Squad/lib/boto3/session.py", line 17, in <module>
import botocore.session
File "/Users/squad/Desktop/Squad/Squad/lib/botocore/session.py", line 32, in <module>
from botocore.loaders import create_loader
File "/Users/squad/Desktop/Squad/Squad/lib/botocore/loaders.py", line 188, in <module>
class Loader(object):
File "/Users/squad/Desktop/Squad/Squad/lib/botocore/loaders.py", line 201, in Loader
CUSTOMER_DATA_PATH = os.path.join(os.path.expanduser('~'),
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 261, in expanduser
import pwd
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 963, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named pwd
我可以很好地使用Boto,所以这不是一个迫切的需要,但如果可能的话,我更喜欢使用Boto3。在
我正在使用Python2.7,如果这有帮助的话。在
谢谢你的帮助。在
您必须伪造
pwd
模块。在使用必要的垫片创建一个名为
fake_pwd.py
的文件:然后,在
^{pr2}$appengine_config.py
中,尝试以下方法:相关问题 更多 >
编程相关推荐