1

I am trying to set up a python source file for a Google Cloud. I have installed a GSUtil on my MAC OS 10.6 and set up the path for files as instructed on the page adding this command (export PYTHONPATH=${PYTHONPATH}:$HOME/gsutil/boto:$HOME/gsutil) to .bash_profile under the home directory.

Then, I ran the following code:

#!/usr/bin/python

import StringIO
import os
import shutil
import tempfile
import time
from oauth2_plugin import oauth2_plugin

import boto

# URI scheme for Google Cloud Storage.
GOOGLE_STORAGE = 'gs'
# URI scheme for accessing local files.
LOCAL_FILE = 'file'

And, the compiler gave me an error saying

>>> [evaluate gs.py]
Traceback (most recent call last):
  File "/Volumes/WingIDE-101-4.0.0/WingIDE.app/Contents/MacOS/src/debug/tserver/_sandbox.py", line 8, in <module>
  File "/Users/lsangin/oauth2_plugin.py", line 18, in <module>
  File "/Users/lsangin/google_appengine/cloudauth/oauth2client/appengine.py", line 24, in <module>
    from google.appengine.ext import db
ImportError: No module named google.appengine.ext
>>> from google.appengine.ext

Can someone help me with the issue? (Sorry, I am a newbie!) Thank you in advance.

1
  • Did you install appengine's sdk inside your PYTHONPATH? Commented Feb 9, 2012 at 5:42

4 Answers 4

1

When you run or deploy your code as a Google App Engine application, the AE tools make sure you have access to the AE specific modules (e.g. google.appengine.ext) but it sounds like you're trying to run this script as a stand alone program, outside of app engine. If so, you may not need the appengine module (hard to say for sure without seeing more of your code). If I'm correct and this is a little test code to run outside AE, try commenting out the import and references to the missing module. Once you get that working, uncomment that code if/when you're ready to try your program under app engine (either the local dev environment or hosted service).

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

Comments

0

Did you move (or copy) oauth2_plugin.py into a different place? What you have in that stack trace shows cloudauth/oauth2_plugin.py (which is the plugin that works with app engine), not oauth2_plugin/oauth2_plugin.py (which is likely the one you want).

What's your full PYTHONPATH?

1 Comment

Hi My PYTHONPATH is export PATH=${PATH}:$HOME/gsutil export PYTHONPATH=${PYTHONPATH}:$HOME/gsutil:$HOME/gsutil/boto
0

Sounds like you are importing the wrong oauth2_plugin because the one in gsutil/oauth2_plugin does not depend on app engine.

I had the same problem because I previously tested with gsutil/cloudauth/oauth2_plugin.py and it was still in PYTHONPATH.

Try refreshing the PYTHONPATH with:

PYTHONPATH=""
source ~/.bashrc

Comments

0

I had this same problem -- I solved it by adding a directory to my PYTHONPATH: https://stackoverflow.com/a/19019234/1741654

Comments

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.