I am still new to Python and GAE. I have an application on local server that is running just fine. I can add entity to my datastore, I can view my website, etc: everything is fine.
Now I am trying to use bulkloader to add entities to my datastore. I followed the tutorial at https://developers.google.com/appengine/docs/python/tools/uploadingdata. My loader is below:
from google.appengine.ext import ndb
from google.appengine.tools import bulkloader
import my_model
class ArticleLoader(bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, 'Article',
[('title', str),
('author', str)
])
loaders = [ArticleLoader]
I am getting the error:
No module named my_model
Does anyone have a fix for this?
Note: I am only using one directory. So my loader is in the same location as the other file that imports the my_model
module.
This can also happen if your
PYTHONPATH
is not properly set up. If you're on Linux, try running this before you run the Bulkloader:This appends your current directory to your
PYTHONPATH
and should make yourmy_model
module visible. Since my memory is terrible and I always forget to do it, I've ended up using a simple shell script that includes this at the beginning and then the bulkload command itself.If you're on Windows, you should be able to modify your path by using
sys.path.append
. Haven't tested this, but you could try adding this to your script (note that this should work on Linux as well):Your code should be located in a file named
my_model.py
. You are getting that error because there is no module namedmy_module
. Might be worth a read of the Python module and package docs.