ImportError: there is no module named pwd in the application.

I am trying to run a python flash based application in a google application using a cloud data storage. I follow the example of a bookshelf - https://cloud.google.com/python/getting-started/using-cloud-datastore

Everything seems to work on the local machine, but in the application, I get ImportError: No module named pwd , which is imported by the oauth2client library.

Is there something that I am missing. Any help would be appreciated.

The question referenced by the duplicate is different. The application there seems to fail only locally, whereas for me everything works locally, but it does not 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 
+2
google-app-engine flask
source share
2 answers

The error was caused by http://github.com/google/oauth2client/issues/578 .

It will be fixed in a couple of weeks with the new AppEngine SDK. In the meantime, you can downgrade the oauth2client library in the app.yaml file.

+1
source share

I had the same issue, which is a known issue for the SDK. I tried other solutions suggested in SO (see Google App Engine 'There is no module named pwd' ), but this did not work. I found work by installing an older version of oauth2client-2.0.0, overwriting oauth2client-4.0.0, which comes with the pubsub pip installation. Try running pip install -t ./lib/ --upgrade --force-reinstall oauth2client==2.0.0 in the project directory and try again.

-one
source share

All Articles