0

I'm trying to do some local processing of data entries from the GAE datastore and I am trying to do this by using the remote_api. I just want to write some quick processing scripts that pull some data, but I am getting import errors saying that Python cannot import from google.

Am I supposed to run the script from within the development environment somehow. Or perhaps I need to include all of the google stuff in my Python path? That seems excessive though.

1 Answer 1

1

Why is including the paths that onerous ?

Normally the remote_api shell is used interactively but it is a good tool that you can use as the basis of acheiving what your want.

The simplest way will be to copy and modify the remote_api shell so that rather than presenting an interactive shell you get it to run a named script.

That way it will deal with all the path setup.

In the past I have integrated the remote_api inside a zope server, so that plone could publish stuff to appengine. All sort of things are possible with remote_api, however you need to deal with imports like anything else in python, except that appengine libraries are not installed in site-packages.

Sign up to request clarification or add additional context in comments.

6 Comments

I don't like this solution because the include path is somewhat convoluted and I don't want to rely on internal Google configs for library files. In the event they ever moved then it would break the scripts.
Also, copying and modifying the remote_api shell seems like a lot, I checked out the file and there's a lot in there. Is there a way to run the GAE python interpreter instead of the standard one installed on your machine? That seems like the path of least resistance.
To modify remote_api_shell to run an arbitrary script is about 3-4 lines of code. ANd yes, if you just run remote_api_shell you have exactly that, an sheel with access to remote api, its a really good way of debugging and manipulating data.
What about remote_api_stub? Presumably they intended that file for this sort of use case, not a repurposing of remote_api_shell? I'm somewhat unclear on how exactly I'm supposed to use the stub. They give an example, but you would get a bunch of import errors without including all of the Google libraries
Correct, thats what I use inside zope, however you said you didn't want to set up the paths for importing libraries, thats why I suggested using the remote_api_shell and modifying it to run an arbitrary script. Just trying to come up with an answer that you find acceptable, - either deal with importing google libs and setting the paths etc... or copy and modify remote_api_shell, take you pick which you find the least offensive.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.