I know this is covered amply in the GAE help site. It's not working out for me. I'm a little green on Python. But I also know how imports work. The entities module is right there in the same folder with the loader. So what are the GAE scripts doing?
Here's my loader:
from google.appengine.ext import db
from google.appengine.tools import bulkloader
import entities
class CardLoader(bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, 'Card',
[('english', str),
('translation', str)
])
loaders = [CardLoader]
Here is what is in a file called entities.py
from google.appengine.ext import db
class Card(db.Model):
english = db.StringProperty(required=True)
translation = db.StringProperty(required=True)
Here's a snip of what's in the .csv
"cardId","english","translation"
"3994","face","la cara"
"4027","art","el arte"
My version of Python:
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Here's my command (on Windows):
python "c:\Program Files\Google\google_appengine\appcfg.py" upload_data --config_file=card_loader.py --url http://localhost:8080/remote_api --filename=card_data.csv --kind=Card
Here's the output:
Uploading data records.
[INFO ] Logging to bulkloader-log-20110723.183520
[INFO ] Throttling transfers:
[INFO ] Bandwidth: 250000 bytes/second
[INFO ] HTTP connections: 8/second
[INFO ] Entities inserted/fetched/modified: 20/second
[INFO ] Batch Size: 10
Please enter login credentials for localhost:8080
Email: admin
Password for admin:
Traceback (most recent call last):
File "c:\Program Files\Google\google_appengine\appcfg.py", line 76, in <module
>
run_file(__file__, globals())
File "c:\Program Files\Google\google_appengine\appcfg.py", line 72, in run_fil
e
execfile(script_path, globals_)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 3708, in <module>
main(sys.argv)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 3699, in main
result = AppCfgApp(argv).Run()
File "c:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 2345, in Run
self.action(self)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 3484, in __call__
return method()
File "c:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 3311, in PerformUpload
run_fn(args)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.p
y", line 3202, in RunBulkloader
sys.exit(bulkloader.Run(arg_dict))
File "c:\Program Files\Google\google_appengine\google\appengine\tools\bulkload
er.py", line 4369, in Run
return _PerformBulkload(arg_dict)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\bulkload
er.py", line 4180, in _PerformBulkload
LoadConfig(config_file)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\bulkload
er.py", line 3844, in LoadConfig
('', 'r', imp.PY_SOURCE))
File "card_loader.py", line 3, in <module>
import entities
ImportError: No module named entities