ImportError: cannot import name CredentialsNDBProperty - google-app-engine

using appengine and Ferris, I am receiving this error when trying to use bulkloader.yaml.
from oauth2client.appengine import CredentialsNDBProperty, StorageByKeyName
ImportError: cannot import name CredentialsNDBProperty

Have you this problem only when your code is deployed ?
In localhost, if you have oauth2client installed into python/site-package, AppEngine devserver use it. But when you deploy your application on App Engine, you need to embed this library in your project.
The list of third-party libraries include into App Engine python runtime : https://developers.google.com/appengine/docs/python/tools/libraries27

Related

ImportError when using google.cloud library in app engine dev

I have done the following, installed google cloud in a local lib folder with pip. Added an appengine_config.py file:
from google.appengine.ext import vendor
vendor.add("lib")
But still get:
ImportError: No module named google.cloud.bigquery
It seems there is some kind of conflict in the google namespace, since other dependendices in the lib folder seems to be possible to import.
If I just override with:
google.cloud.__path__ = ['/Users/okku/dev/MyServer/lib/google/cloud']
Then it works, but some other dependcy failes to be imported in this case google.api_core.
I have been on this for half day now. I cant find whats wrong. Any clues?

Cloud storage client libraries not working. No module appengine.api

I'm trying to set up the cloud storage client libraries so I can store images for my gae app using python. I'm following the instructions here:
https://cloud.google.com/storage/docs/reference/libraries
Unfortunately when I import the storage module:
from google.cloud import storage
something goes wrong saying:
ImportError: No module named appengine.api
Is there a way i can check if I have appengine.api installed at all (which I believe i do. It should have been included in the app engine sdk i installed)? If it's not installed how can I install it?
The GCS library is not included the GAE SDK, it has to be vendored in as a 3rd party lib.
See also Downloading the client library in the GAE Setting Up Google Cloud Storage doc.

ImportError: No module named google.appengine.ext.webapp.mail_handlers

I'm trying to get google app engine to work on my Raspberry Pi. I keep getting this error.
Traceback (most recent call last):
File "main.py", line 26, in <module>
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler
ImportError: No module named google.appengine.ext.webapp.mail_handlers
I downloaded google app engine and then ran these commands:
unzip google_appengine_1.9.40.zip
export PATH=$PATH:/home/pi/google_appengine/
The most trivial solution for such errors is to import the required package into you project directory. but to be honest it is not the best way to resolve this one. you may use Google App Engine SDK which will take care of all that headache, or there are another way you can follow:
Create a folder into your project directory and call it lib
Add all required packages into this folder.
Create a .py file and name it appengine_config.py
Add the below code snippets into this file:
import sys
import os.path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
appengine_config.py gets loaded every time a new instance is started, and should take care of your modules importing.
Regards.
It appears you're trying to directly execute your main.py as a standalone application, which is not how GAE app code works.
You're supposed to get the development server (from the SDK you downloaded) to execute your app code on your development machine (on GAE it's the GAE infra doing that). See Using the Local Development Server.

Import Error on Google AppEngine : No module named oauth2

Im running Google AppEngine. I have oauth2 installed. Im successfully able to import oauth2 in program but when I run my python application using GoogleAppEngine Launcher on localhost, then I get the following error
ImportError: No module named oauth2
Im using Python2.7 which is not the default version of GoogleAppEngine, but I have changed the python path both in my project and in GoogleAppEngine Launcher.
Have you looked at this example? It shows OAuth2 being used in a Google App Engine Python project. This might give you a better sense of how to use OAuth2 and GAE.
Are you trying to authenticate inbound HTTP requests on App Engine using OAuth2?
I just posted a full end to end example here:
google app engine oauth2 provider

ImportError: cannot import name taskqueue

I am trying to use AppEngine TaskQueue API, so I import it like this:
from google.appengine.api import taskqueue
The code works perfectly online. But when I try to run it locally, I get this error:
ImportError: cannot import name taskqueue
I checked the directory of AppEngine and I didn't find the file taskqueue.py which explains the error. Is there any reason why this file isn't included in the AppEngine SDK? And is there anyway to install it locally? I wouldn't trust just copying the file to the folder, because I am sure it depends on tens of other files.
Download and install the current SDK. You're using an older version.
OK, I found the solution for this myself. I just downloaded the latest AppEngine SDK (version 1.4) and it has the taskqueue.

Resources