Graham Walters
Graham Walters

Reputation: 2064

GAE doesn't import gflags

I'm trying to get oauth to work on Google App Engine (GAE), but I'm unable to import the OAuth2Decorator, because it tries to import gflags and fails.

In command line I've ran help('modules') and gflags is listed, and I've ran import os + import gflags + print os.path.dirname(gflags.__file__) and received /Library/Python/2.7/site-packages/python_gflags-2.0-py2.7.egg.

In GAE Dev Console I've ran:

import sys
import os

try:
  import webapp2
  import httplib2
  from oauth2client.appengine import OAuth2Decorator 

except ImportError, e:
  print("The import failed!")
  print(e)

and received:

The import failed!
No module named gflags

gflags is imported by from oauth2client.appengine import OAuth2Decorator, but GAE fails to import gflags every time I run the code.

I'm not sure it makes a difference, but I'm running Mac OS 10.7.5 and python 2.7.1

Upvotes: 6

Views: 3287

Answers (2)

Joe Gregorio
Joe Gregorio

Reputation: 770

Sorry, I just recently updated the installation instructions with App Engine specific instructions:

https://developers.google.com/api-client-library/python/start/installation

There is a download specifically for App Engine that contains all the client library code and dependencies, just unzip that file into your project and you should be good to go.

Upvotes: 6

Dan Holevoet
Dan Holevoet

Reputation: 9183

You'll need to add the required library files to your App Engine project. From the client library docs, once you've installed the client library run:

$ enable-app-engine-project your_app_directory

Upvotes: 2

Related Questions