Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
992 views
in Technique[技术] by (71.8m points)

python 2.7 - ImportError: no module named pwd in app engine

I'm trying to run a python flask based application on google app engine using cloud datastore. I'm following the bookshelf example - https://cloud.google.com/python/getting-started/using-cloud-datastore

Everything seems to work in local machine but on app engine, I'm getting ImportError: No module named pwd, which is being imported by oauth2client library.

Is there anything I'm missing. Any help will be appreciated.

The question referenced as duplicate is different. The application there seems to fail only locally, whereas for me everything works locally but fails to work in GAE.

Here's the stack trace (partial) -

...
1384/v1.394932573930853146/application/home/model.py", line 16, in save_user
    ds = get_client()
  File "/base/data/home/apps/s~bookshelf-1384/v1.394932573930853146/application/home/model.py", line 7, in get_client
    return datastore.Client('bookshelf-1384')#current_app.config['PROJECT_ID'])
  File "/base/data/home/apps/s~bookshelf-1384/v1.394932573930853146/lib/gcloud/datastore/client.py", line 173, in __init__
    super(Client, self).__init__(credentials, http)
  File "/base/data/home/apps/s~bookshelf-1384/v1.394932573930853146/lib/gcloud/client.py", line 122, in __init__
    credentials = get_credentials()
  File "/base/data/home/apps/s~bookshelf-1384/v1.394932573930853146/lib/gcloud/credentials.py", line 82, in get_credentials
    return client.GoogleCredentials.get_application_default()
  File "/base/data/home/apps/s~bookshelf-1384/v1.394932573930853146/lib/oauth2client/client.py", line 1288, in get_application_default
    return GoogleCredentials._get_implicit_credentials()
  File "/base/data/home/apps/s~bookshelf-1384/v1.394932573930853146/lib/oauth2client/client.py", line 1273, in _get_implicit_credentials
    credentials = checker()
  File "/base/data/home/apps/s~bookshelf-1384/v1.394932573930853146/lib/oauth2client/client.py", line 1226, in _implicit_credentials_from_files
    credentials_filename = _get_well_known_file()
  File "/base/data/home/apps/s~bookshelf-1384/v1.394932573930853146/lib/oauth2client/client.py", line 1392, in _get_well_known_file
    default_config_dir = os.path.join(os.path.expanduser('~'),
  File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/posixpath.py", line 268, in expanduser
    import pwd
ImportError: No module named pwd
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...