Fell into the same trap.

    entities = query.fetch(batch_size)
  File 
"/home/kamel/Library/google_appengine/google/appengine/ext/db/__init__.py", 
line 2157, in fetch
    return list(self.run(limit=limit, offset=offset, **kwargs))
  File 
"/home/kamel/Library/google_appengine/google/appengine/ext/db/__init__.py", 
line 2326, in next
    return self.__model_class.from_entity(self.__iterator.next())
  File 
"/home/kamel/Library/google_appengine/google/appengine/ext/db/__init__.py", 
line 1435, in from_entity
    entity_values = cls._load_entity_values(entity)
  File 
"/home/kamel/Library/google_appengine/google/appengine/ext/db/__init__.py", 
line 1413, in _load_entity_values
    value = prop.make_value_from_datastore(value)
  File "/home/kamel/labola/src/model/properties.py", line 295, in 
make_value_from_datastore
    return pickle.loads(value)
  File "/usr/lib/python2.7/pickle.py", line 1382, in loads
    return Unpickler(file).load()
  File "/usr/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/lib/python2.7/pickle.py", line 1083, in load_newobj
    obj = cls.__new__(cls, *args)
AttributeError: class Reference has no attribute '__new__'
在 2013年3月29日星期五UTC+9上午5时42分42秒,Alex Burgel写道:
>
> Hi,
>
> I've been pickling some data to store in a datastore blob, and recently I 
> tried to download and unpickle the data on my local machine. I got errors 
> whenever I tried to do this because it seems like production uses a 
> different version of ProtocolBuffers than the SDK.
>
> Part of the pickled data contained an appengine Key, which contains a 
> reference to a google.appengine.datastore.entity_pb.Reference, which is a 
> subclass of google.net.proto.ProtocolBuffer.ProtocolMessage. On the SDK, 
> this is old-style python class. But it looks like its a new-style class on 
> production. (Of course, I can't see the code, but it hasattr '__new__' and 
> '__class__').
>
> I'm not sure if this is a bug. It seems like you should be able to pickle 
> app engine classes, and it would be nice if you could read that data in the 
> SDK.
>
> This is the exception that I get when trying to unpickle in the dev SDK:
>
> Traceback (most recent call last):
>   File "<console>", line 1, in <module>
>   File 
> "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py",
>  
> line 1382, in loads
>     return Unpickler(file).load()
>   File 
> "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py",
>  
> line 858, in load
>     dispatch[key](self)
>   File 
> "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py",
>  
> line 1083, in load_newobj
>     obj = cls.__new__(cls, *args)
> AttributeError: class Reference has no attribute '__new__'
>
> --Alex
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.

Reply via email to