Here is my stack of the same problem.
File "C:\work\twist.2\server\backend\lib\images\image_helper.py", line 18, in
get_serving_url
return images.get_serving_url(image_blob_key)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\imag
es\__init__.py", line 1793, in get_serving_url
return rpc.get_result()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apip
roxy_stub_map.py", line 604, in get_result
return self.__get_result_hook(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\imag
es\__init__.py", line 1889, in get_serving_url_hook
rpc.check_success()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apip
roxy_stub_map.py", line 570, in check_success
self.__rpc.CheckSuccess()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apip
roxy_rpc.py", line 156, in _WaitImpl
self.request, self.response)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apip
roxy_stub.py", line 160, in MakeSyncCall
method(request, response)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\imag
es\images_stub.py", line 296, in _Dynamic_GetUrlBase
datastore.Put(entity_info)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\data
store.py", line 579, in Put
return PutAsync(entities, **kwargs).get_result()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\data
store.py", line 556, in PutAsync
return _GetConnection().async_put(config, entities, local_extra_hook)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastor
e\datastore_rpc.py", line 1534, in async_put
pbs = [self.__adapter.entity_to_pb(entity) for entity in entities]
File "C:\work\twist.2\server\backend\lib\external\ndb\model.py", line 561, in
entity_to_pb
pb = ent._to_pb()
AttributeError: 'Entity' object has no attribute '_to_pb'
i have ran into the same type of problem before. the problem is the sdk tries to cache the datastore_rpc connection. see _GetConnection in datastore.py
def _GetConnection():
"""Retrieve a datastore connection local to the thread."""
connection = None
if os.getenv(_ENV_KEY):
try:
connection = _thread_local.connection
except AttributeError:
pass
if connection is None:
connection = datastore_rpc.Connection(adapter=_adapter)
_SetConnection(connection)
return connection
an incorrect datastore connection is being used for that call from this connection cache.
you can hack around it by adding this before the get_serving_url call.
import os
from google.appengine.api import datastore
os.environ[datastore._ENV_KEY] = ''
os.putenv(datastore._ENV_KEY, '')
datastore._thread_local.connection = None