我将我的httplib2目录复制到我的GAE项目中,现在我收到以下错误:
line 64, in <module> _ssl_wrap_socket = ssl.wrap_socket
这是Google App Engine的问题,还是我错误地安装了我的httplib2?
完整的错误转储,作为请求(它很大!):
--> --> -->
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 4053, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3977, in _Dispatch
base_env_dict=env_dict)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 588, in Dispatch
base_env_dict=base_env_dict)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3050, in Dispatch
self._module_dict)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2954, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2834, in ExecuteOrImportScript
exec module_code in script_module.__dict__
File "C:\Users\quaunaut\Documents\Aptana Studio 3 Workspace\qushoutout\src\main.py", line 25, in <module>
import twitter as twitter
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1505, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2450, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1505, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2339, in FindAndLoadModule
description)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1505, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2282, in LoadModuleRestricted
description)
File "C:\Users\quaunaut\Documents\Aptana Studio 3 Workspace\qushoutout\src\twitter.py", line 65, in <module>
import oauth2 as oauth
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1505, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2450, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1505, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2339, in FindAndLoadModule
description)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1505, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2282, in LoadModuleRestricted
description)
File "C:\Users\quaunaut\Documents\Aptana Studio 3 Workspace\qushoutout\src\oauth2\__init__.py", line 32, in <module>
import httplib2
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1505, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2450, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1505, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2339, in FindAndLoadModule
description)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1505, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2282, in LoadModuleRestricted
description)
File "C:\Users\quaunaut\Documents\Aptana Studio 3 Workspace\qushoutout\src\httplib2\__init__.py", line 64, in <module>
_ssl_wrap_socket = ssl.wrap_socket
AttributeError: 'module' object has no attribute 'wrap_socket'
还有这个问题。关于我能想到的唯一可能导致这种情况的是我的机器运行Python 2.7;是否可能导致问题?
答案 0 :(得分:4)
作为解决方法:
您可以使用Google App Engine SDK 1.4.3(这看起来像1.5.0回归)。
或者使用:
强制httplib.FakeSocket上的httplib2回退import sys
sys.modules['ssl'] = None
import httplib2
那里填补了一个新问题: http://code.google.com/p/googleappengine/issues/detail?id=5064
它看起来已在httplib2方面修复: http://code.google.com/p/httplib2/source/detail?r=cf721c1693a68e9438899be3d78acccae6ab0e30#
答案 1 :(得分:2)
AppEngine沙箱不允许访问套接字API,因为http库可以在GAE上运行,它必须包装urllib(后者又包含url_fetch API)。
编辑看起来httplib2 应工作,所以我猜您只需要确保路径设置正确。
答案 2 :(得分:0)
此Blog声明要解决GAE问题。我还没试过,但听起来不错。