Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 972
Graham Walters Avatar asked Nov 25 '12 03:11

Graham Walters


2 Answers

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.

like image 70
Joe Gregorio Avatar answered Oct 13 '22 15:10

Joe Gregorio


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
like image 39
Dan Holevoet Avatar answered Oct 13 '22 16:10

Dan Holevoet