GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fail to import ServiceAccountCredentials within GAE endpoint tool · Issue #1705 · googleapis/google-cloud-python

Fail to import ServiceAccountCredentials within GAE endpoint tool #1705

New issue
Copy link
New issue
Copy link
Closed
Closed
Fail to import ServiceAccountCredentials within GAE endpoint tool#1705
Copy link
Labels
authtype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@ghost
ghost
opened on Apr 8, 2016

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

Activity

Next
  1. ghost changed the title [-]Fails to import ServiceAccountCredentials in GAE endpoint tool[/-] [+]Fail to import ServiceAccountCredentials in GAE endpoint tool[/+] on Apr 8, 2016
  2. ghost changed the title [-]Fail to import ServiceAccountCredentials in GAE endpoint tool[/-] [+]Fail to import ServiceAccountCredentials within GAE endpoint tool[/+] on Apr 8, 2016
  3. jgeewax commented on Apr 8, 2016

    @jgeewax
    jgeewax
    on Apr 8, 2016
    Contributor
    More actions

    I'm guessing that maybe App Engine provides a different version of oauth2client somehow?

    Can you add a line in your code that does:

    import oauth2client
    print oauth2client.__version__

    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)

    Reacted by anasos and Alex
  4. jgeewax
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    auth
    on Apr 8, 2016
  5. jgeewax commented on Apr 8, 2016

    @jgeewax
    jgeewax
    on Apr 8, 2016
    Contributor
    More actions

    OK -- if you have oauthclient 2.0.1 in your directory, then all you'd need to do is put it first in the PYTHONPATH environment variable and then it'll use that one.

  6. jgeewax commented on Apr 8, 2016

    @jgeewax
    jgeewax
    on Apr 8, 2016
    Contributor
    More actions

    I actually don't know for sure, but all you need is to make sure the oauth2client that you have (which is the right version) is the one used by your code... I'd assume you'd need to vendor.add('path/to/oauth2client')

  7. dhermes commented on Apr 8, 2016

    @dhermes
    dhermes
    on Apr 8, 2016
    Contributor
    More actions

    @jonparrott is the author of vendor he can chime in?

  8. theacodes commented on Apr 8, 2016

    @theacodes
    theacodes
    on Apr 8, 2016
    Contributor
    More actions

    The problem is that endpointscfg.py doesn't load appengine_config.py. I'm actually the one who reported this issue.

    A workaround is to just import appengine_config yourself as soon as possible in your code.

  9. dhermes commented on Apr 8, 2016

    @dhermes
    dhermes
    on Apr 8, 2016
    Contributor
    More actions

    @cyluss LMK if this doesn't work for you and we can re-open and discuss.

  10. 3 remaining items

  11. theacodes commented on Apr 11, 2016

    @theacodes
    theacodes
    on Apr 11, 2016
    Contributor
    More actions

    Can you print sys.path after importing appengine_config and oauth2client.__version__?

  12. theacodes commented on Apr 13, 2016

    @theacodes
    theacodes
    on Apr 13, 2016
    Contributor
    More actions

    @cyluss sorry for the delay, can you tell me what oauth2client.__version__ and oauth2client.__file__ is after import appengine_config?

  13. theacodes commented on Apr 13, 2016

    @theacodes
    theacodes
    on Apr 13, 2016
    Contributor
    More actions

    Can you try doing this nonsense in appengine_config.py after the vendor call?

    import sys
    
    if 'oauth2client' in sys.modules:
        del sys.modules['oauth2client']
  14. theacodes commented on Apr 14, 2016

    @theacodes
    theacodes
    on Apr 14, 2016
    Contributor
    More actions

    Great.

    The long and short is that app engine is barrels of fun when it comes to user-provided newer versions of bundled libraries.

    Reacted by Alex
    Reacted by Mike Lambert
    Reacted by Mike Lambert
  15. parthea
    added a commit that references this issue on Nov 26, 2025

    chore(main): release 2.39.0 (#1705)

    041248a
  16. parthea
    added 3 commits that reference this issue on Mar 6, 2026

    chore: upgrade mypy (#1705)

    04ad152

    feat(samples): add samples for appendable objects writes and reads (#…

    27aedf8

    chore: librarian release pull request: 20260202T123858Z (#1736)

    aac3fd4
  17. parthea
    added a commit that references this issue on Apr 1, 2026

    feat: support to_strip parameter for str.strip, str.lstrip and str.rs…

    9a0469b
  18. parthea
    added a commit that references this issue on Sep 8, 2026

    docs: migrate code from googleapis/python-bigquery (#18303)

    23f9a74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authtype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.