GAE SDK 1.9.5 and an InvalidCertificateException

2020-06-21 06:15发布

Trying to import testbed from GAE SDK 1.95 with Python2.7.8 on osX Maverics 10.9.5 and I'm getting a InvalidCertificateException error.

    from google.appengine.ext import testbed   
  File "/usr/local/google_appengine/google/appengine/ext/testbed/__init__.py", line 120, in <module>  
    from google.appengine.api import urlfetch_stub   
  File "/usr/local/google_appengine/google/appengine/api/urlfetch_stub.py", line 34, in <module>  
    _fancy_urllib_InvalidCertException = fancy_urllib.InvalidCertificateException  
AttributeError: 'module' object has no attribute 'InvalidCertificateException'   

I looked at the fancy_url module and the InvalidCertificateException class is there, so I don't understand why it's not importing.

Apparently others have had the same error, so I attempt to correct it by deleting: urlfetch_cacerts.txt AND cacerts.txt from:

GoogleAppEngineLauncher/Contents/Resources/GoogleAppEngineDefault.bundle/Content‌​s/Resources/google_appengine/lib/cacerts/

1条回答
劳资没心,怎么记你
2楼-- · 2020-06-21 06:39

Apparently the GAE installer creates a nested directory, this was fixed by copying the contents in:

cd /usr/local/google_appengine/lib
cp fancy_urllib/fancy_urllib/__init__.py fancy_urllib/__init__.py 

This is how the module is incorrectly structured, it looks like these 2 init.py files are duplicate:

/usr/local/google_appengine/lib/fancy_urllib/__init__.py   # this file is empty
/usr/local/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py # this file contains the functions.

FIXED THE ERROR

查看更多
登录 后发表回答