google-cloud-python: Fail to import ServiceAccountCredentials within GAE endpoint tool
I am generating some GAE endpoints library. When running endpoints tool(endpointscfg.py get_client_lib ... ), gcloud import fails.
Third party libraries are bundled with GAE project, and oauth2client-2.0.1 is actually exists in library directory.
Affecting versions: 0.10 and above
Traceback (most recent call last):
File "/usr/local/bin/endpointscfg.py", line 133, in <module>
run_file(__file__, globals())
File "/usr/local/bin/endpointscfg.py", line 129, in run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 561, in <module>
main(sys.argv)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 557, in main
args.callback(args)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 426, in _GetClientLibCallback
hostname=args.hostname, application_path=args.application)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 388, in _GetClientLib
application_path=application_path)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 187, in GenApiConfig
module = __import__(module_name, fromlist=base_service_class_name)
File "/Users/kang/jackend/main.py", line 10, in <module>
from auth.services import JackEndAuthAPI
File "/Users/kang/jackend/auth/services.py", line 12, in <module>
from . import (
File "/Users/kang/jackend/auth/storage.py", line 9, in <module>
from ext import cloudstorage as storage
File "/Users/kang/jackend/ext/cloudstorage.py", line 9, in <module>
from gcloud import (
File "/Users/kang/jackend/lib/gcloud/storage/__init__.py", line 45, in <module>
from gcloud.storage.client import Client
File "/Users/kang/jackend/lib/gcloud/storage/client.py", line 19, in <module>
from gcloud.client import JSONClient
File "/Users/kang/jackend/lib/gcloud/client.py", line 17, in <module>
from oauth2client.service_account import ServiceAccountCredentials
ImportError: cannot import name ServiceAccountCredentials
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 22 (10 by maintainers)
My
appengine_config.pylooks like this now:This workaround would be useful for swapping GAE provided libraries.
Great.
The long and short is that app engine is barrels of fun when it comes to user-provided newer versions of bundled libraries.
I’m guessing that maybe App Engine provides a different version of oauth2client somehow?
Can you add a line in your code that does:
It should show
'2.0.1'if you’re using the one in the library directory. (the variable is defined here: https://github.com/google/oauth2client/blob/master/oauth2client/__init__.py)