最近,我将GAE SDK升级为ver。 1.7.4当我尝试运行开发服务器时,它开始抛出'InvalidCertificateException'。我搜索了这个错误,有些人说它随着时间的推移而消失,但我没有。我应该考虑什么来解决这个问题?我正在使用python框架Django为我的应用程序,如果必须以某种方式。
$ dev_appserver.py ./
INFO 2012-12-16 07:44:31,412 appcfg.py:586] Checking for updates to the SDK.
Traceback (most recent call last):
File "/usr/local/bin/dev_appserver.py", line 171, in <module>
run_file(__file__, globals())
File "/usr/local/bin/dev_appserver.py", line 167, in run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_main.py", line 747, in <module>
sys.exit(main(sys.argv))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_main.py", line 680, in main
update_check.CheckForUpdates()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 597, in CheckForUpdates
runtime=self.config.runtime)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appengine_rpc.py", line 391, in Send
f = self.opener.open(req)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 394, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 412, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1207, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line 379, in do_open
url_error.reason.args[1])
fancy_urllib.InvalidCertificateException: Host appengine.google.com returned an invalid certificate (_ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed):
To learn more, see http://code.google.com/appengine/kb/general.html#rpcssl
答案 0 :(得分:39)
我找到的快速解决方法:从已安装的SDK中删除文件google_appengine/lib/cacerts/cacerts.txt
。
从GoogleAppEngineLauncher开始:
GoogleAppEngineLauncher /内容/资源/ GoogleAppEngineDefault.bundle /内容S /资源/ google_appengine / LIB / cacerts中/ cacerts.txt
编辑#
从谷歌应用引擎SDK 1.8.1开始,此文件已重命名为 urlfetch_cacerts.txt。仍然在同一目录中并删除它 仍然解决了这个问题。
- @Harrison
答案 1 :(得分:2)
紧凑的答案,截至2014年1月的最新消息(刚刚完成SDK更新):
rm file /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cacerts/urlfetch_cacerts.txt
或......
cd /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cacerts/
rm urlfetch_cacerts.txt
一切都顺利进行。
你最好删除“cacerts.txt”(在同一目录中)。否则,sdk命令行工具也会抛出异常:(
答案 2 :(得分:1)
仅供参考:如果您使用的是运行Mavericks的Mac,则此错误可能是由于使用了python 2.7.6或更低版本,其中有一个导致此错误的已知错误。
例如,只需尝试获取任何SSL页面,您就会收到类似的错误:
pip install requests
python
>>> import requests
>>> requests.get("https://github.com")
以上将产生相同的SSL证书错误。在这种情况下,gcloud(Google云SDK)命令都不起作用。
升级到python 2.7.8(或更新的2.7.X)来解决问题(对我有用)。
答案 3 :(得分:0)
将Python从2.7.3升级到2.7.9为我修复了它。我使用的是Mac OS X 10.6.8(Snow Leopard)。