Bulkloader does not import ndb.model

I am still new to Python and GAE. I have an application on a local server that is working fine. I can add an entity to my data warehouse, I can browse my site, etc .: Everything is in order.

Now I'm trying to use bulkloader to add objects to my data warehouse. I completed the tutorial at https://developers.google.com/appengine/docs/python/tools/uploadingdata . My bootloader 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 get an error message:

No module named my_model

Does anyone have a fix?

Note. I use only one directory. Thus, my bootloader is in the same place as another file that the module imports my_model.

+1
source share
2

, PYTHONPATH . Linux, Bulkloader:

export PYTHONPATH=$PYTHONPATH:.

​​ PYTHONPATH my_model . , , script, , bulkload.

Windows, , sys.path.append. , script ( , Linux):

import sys
# ...
sys.path.append('.')
+1

my_model.py. , my_module. , Python module package docs.

0

All Articles