1
votes

I'm currently trying to access my app using remote_api_shell.py as documented in appengine at http://code.google.com/appengine/articles/remote_api.html. I am using python 27 in windows 7 and I am able to access the shell - I've remotely cleared the memcache for example. I am having trouble accessing the datastore with the error

no module found named <module name>

My directory stucture something like this

/app.yaml
/main.py
/users/models.py

In the windows shell I type the following (in accordance with the walkthrough at the above link)

C:\Users\user>remote_api_shell.py -s appname.appspot.com
App Engine remote_api shell
Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)]
The db, users, urlfetch, and memcache modules are imported.
s~appname> import appname
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named appname
s~appname> from google.appengine.ext import db
s~appname> from users.models import *
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named users.models
s~appname> from users import models
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named users

I've tried a few different iterations but just cannot seem to access any of my data. I've also tried to access another model in a directory /website/models.py but also no success. Any ideas on how to get this to work? cheers.

2

2 Answers

3
votes

Try setting the module search path to include the directory where your app lives. This can either be done by setting the environment variable PYTHONPATH (though I've forgotten how to do this on Windows), or, inside your shell session, by appending to sys.path.

The reason is that the remote_api_shell script lives in a different directory than your app, so its directory gets added to the path instead of your app's directory, even if the latter is the current directory.

I guess you could also copy remote_api_shell.py into your app directory...

0
votes

Obviously you can copy the models.py into remote_api_shell.py directory {:^)