Hi, It's hard to say based on what you've provided, but it looks like you're trying to set a ReferenceProperty to a str value.
-Nick Johnson On Thu, Oct 22, 2009 at 5:34 PM, chemuto <chem...@gmail.com> wrote: > > Hi! > > I´m getting an error while trying to upload data from a .csv. I need > to do some post processing using handle_entity, but I think i'm > getting the error before entering that function. Could anyone help me > to figure out why im getting the error? > > thanks! > > The call: > appcfg.py upload_data --config_file=WineLoader.py --filename=data > \wines_spain_quotes.csv --kind=Item --url=http://localhost:8080/ > remote_api ../svn > > The error: > > Traceback (most recent call last): > File "C:\Program Files\Google\google_appengine\google\appengine\tools > \adaptive > _thread_pool.py", line 150, in WorkOnItems > status, instruction = item.PerformWork(self.__thread_pool) > File "C:\Program Files\Google\google_appengine\google\appengine\tools > \bulkload > er.py", line 675, in PerformWork > transfer_time = self._TransferItem(thread_pool) > File "C:\Program Files\Google\google_appengine\google\appengine\tools > \bulkload > er.py", line 830, in _TransferItem > self.content = self.request_manager.EncodeContent(self.rows) > File "C:\Program Files\Google\google_appengine\google\appengine\tools > \bulkload > er.py", line 1216, in EncodeContent > entity = loader.create_entity(values, key_name=key, parent=parent) > File "C:\Program Files\Google\google_appengine\google\appengine\tools > \bulkload > er.py", line 2427, in create_entity > entity = model_class(**properties) > File "C:\Program Files\Google\google_appengine\google\appengine\ext > \db\__init_ > _.py", line 709, in __init__ > prop.__set__(self, value) > File "C:\Program Files\Google\google_appengine\google\appengine\ext > \db\__init_ > _.py", line 2814, in __set__ > value = self.validate(value) > File "C:\Program Files\Google\google_appengine\google\appengine\ext > \db\__init_ > _.py", line 2844, in validate > if value is not None and not value.has_key(): > AttributeError: 'str' object has no attribute 'has_key' > [INFO ] Backing off due to errors: 1.0 seconds > [INFO ] An error occurred. Shutting down... > [ERROR ] Error in Thread-1: 'str' object has no attribute 'has_key' > > [INFO ] 1 entites total, 0 previously transferred > [INFO ] 0 entities (0 bytes) transferred in 9.3 seconds > [INFO ] Some entities not successfully transferred > > The Loader: > import datetime, model > from google.appengine.ext import db > from google.appengine.tools import bulkloader > > > class WineLoader(bulkloader.Loader): > def __init__(self): > bulkloader.Loader.__init__(self, 'Item', > [('title', str), > ('author', str) > ]) > def handle_entity(self, entity): > # update author key > f = model.UserData.all().filter("nickname =", > entity['author']).get > () > if f: > entity['author'] = f > else: > entity['author'] = None > return entity > > loaders = [WineLoader] > > > -- Nick Johnson, Developer Programs Engineer, App Engine Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---