GAE Python bulk uploader is giving error: "ImportError: No module named model"

342 views Asked by At

I'm trying to use the bulk uploader in my development environment and I'm running into problems. Here is the error I'm getting:

  File "volume_loader.py", line 3, in <module>
    import model
ImportError: No module named model

I'm in my application directory, called "src" when I run this command:

appcfg.py upload_data --config_file=volume_loader.py --filename=lds_scriptures_volumes.csv --kind=Volume --url=http://localhost:8080/_ah/remote_api

Here is my volume_loader.py. (which is sitting in my src directory)

from google.appengine.ext import db
from google.appengine.tools import bulkloader
import model

class VolumeLoader(bulkloader.Loader):
    def __init__(self):
        bulkloader.Loader.__init__(self, 'Volume',
                                   [('volume_id', int),
                                    ('volume_title', str),
                                    ('volume_title_long', str),
                                    ('volume_subtitle', str),
                                    ('lds_org', str),
                                    ('num_books', int),
                                    ('num_chapters', int),
                                    ('num_verses', int)
                                   ])

loaders = [VolumeLoader]

In my model.py file I have defined a "Volume" which is what I'm trying to import:

class Volume(Base):
  volume_id = ndb.IntegerProperty(required=True)
  volume_title = ndb.StringProperty(required=True)
  volume_title_long = ndb.StringProperty(required=True)
  volume_subtitle = ndb.StringProperty(required=True)
  lds_org = ndb.StringProperty(required=True)
  num_books = ndb.IntegerProperty(required=True)
  num_chapters = ndb.IntegerProperty(required=True)
  num_verses = ndb.IntegerProperty(required=True)

Any ideas why the model can't be found from the volume_loader?

1

There are 1 answers

2
b-ryce On BEST ANSWER

Well, I think I found the answer, but it doesn't look like I'm going to be able to use the bulk uploader anyways since my objects use ndb.

See these answers:

bulkloader not importing ndb.model

dowload app engine ndb entities via bulk exporter / bulk uploader