1

[アップデート]

これはトランザクション内で発生していること、およびこのエラーは dev_appserver で生成されたことに注意してください。本番環境ではテストしていません。これは本番環境では発生しないようです。

[/アップデート]

ここで何が間違っているのかわかりません。私のコードはドキュメントの例とほぼ同じです。

私のコード:

filename = files.blobstore.create(mime_type='application/octet-stream')
with files.open(filename, 'a') as f:
    f.write(json.dumps(oldblocks, separators=(',', ':')))
files.finalize(filename)

スタックトレース:

WARNING  2013-01-16 12:37:49,648 tasklets.py:409] suspended generator transaction(context.py:932) raised AttributeError('Entity' object has no attribute '_to_pb')
ERROR    2013-01-16 12:37:49,648 webapp2.py:1552] 'Entity' object has no attribute '_to_pb'
Traceback (most recent call last):
  File "/home/rye/local/share/google_appengine/lib/webapp2/webapp2.py", line 1535, in __call__
    rv = self.handle_exception(request, response, e)
  File "/home/rye/local/share/google_appengine/lib/webapp2/webapp2.py", line 1529, in __call__
    rv = self.router.dispatch(request, response)
  File "/home/rye/local/share/google_appengine/lib/webapp2/webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/home/rye/local/share/google_appengine/lib/webapp2/webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "/home/rye/local/share/google_appengine/lib/webapp2/webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/home/rye/local/share/google_appengine/lib/webapp2/webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "/home/rye/Dropbox/projects/web/voxwright/voxwright.py", line 202, in put
    result = saveProject(data['id'], data['blocks'])
  File "/home/rye/local/share/google_appengine/google/appengine/ext/ndb/model.py", line 3583, in inner_transactional_wrapper
    return transaction(f, **ctx_options)
  File "/home/rye/local/share/google_appengine/google/appengine/ext/ndb/utils.py", line 136, in positional_wrapper
    return wrapped(*args, **kwds)
  File "/home/rye/local/share/google_appengine/google/appengine/ext/ndb/model.py", line 3526, in transaction
    return fut.get_result()
  File "/home/rye/local/share/google_appengine/google/appengine/ext/ndb/tasklets.py", line 325, in get_result
    self.check_success()
  File "/home/rye/local/share/google_appengine/google/appengine/ext/ndb/tasklets.py", line 371, in _help_tasklet_along
    value = gen.send(val)
  File "/home/rye/local/share/google_appengine/google/appengine/ext/ndb/context.py", line 923, in transaction
    result = callback()
  File "/home/rye/local/share/google_appengine/google/appengine/ext/ndb/model.py", line 3582, in <lambda>
    f = lambda: func(*args, **kwds)
  File "/home/rye/Dropbox/projects/web/voxwright/voxwright.py", line 102, in saveProject
    files.finalize(filename)
  File "/home/rye/local/share/google_appengine/google/appengine/api/files/file.py", line 568, in finalize
    f.close(finalize=True)
  File "/home/rye/local/share/google_appengine/google/appengine/api/files/file.py", line 291, in close
    self._make_rpc_call_with_retry('Close', request, response)
  File "/home/rye/local/share/google_appengine/google/appengine/api/files/file.py", line 427, in _make_rpc_call_with_retry
    _make_call(method, request, response)
  File "/home/rye/local/share/google_appengine/google/appengine/api/files/file.py", line 250, in _make_call
    rpc.check_success()
  File "/home/rye/local/share/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 570, in check_success
    self.__rpc.CheckSuccess()
  File "/home/rye/local/share/google_appengine/google/appengine/api/apiproxy_rpc.py", line 156, in _WaitImpl
    self.request, self.response)
  File "/home/rye/local/share/google_appengine/google/appengine/api/apiproxy_stub.py", line 125, in MakeSyncCall
    method(request, response)
  File "/home/rye/local/share/google_appengine/google/appengine/api/files/file_service_stub.py", line 652, in _Dynamic_Close
    self.open_files[filename].finalize()
  File "/home/rye/local/share/google_appengine/google/appengine/api/files/file_service_stub.py", line 596, in finalize
    datastore.Put(blob_info)
  File "/home/rye/local/share/google_appengine/google/appengine/api/datastore.py", line 579, in Put
    return PutAsync(entities, **kwargs).get_result()
  File "/home/rye/local/share/google_appengine/google/appengine/api/datastore.py", line 556, in PutAsync
    return _GetConnection().async_put(config, entities, local_extra_hook)
  File "/home/rye/local/share/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1542, in async_put
    pbs = [self.__adapter.entity_to_pb(entity) for entity in entities]
  File "/home/rye/local/share/google_appengine/google/appengine/ext/ndb/model.py", line 562, in entity_to_pb
    pb = ent._to_pb()
AttributeError: 'Entity' object has no attribute '_to_pb'
4

1 に答える 1

1

これは私が提起したのと同じバグのようです : http://code.google.com/p/googleappengine/issues/detail?id=8354get_serving_urlそれが重要であることを知っています!(現時点では、ブロブ処理、トランザクション ラップ コードの周りに is_sdk のチェックが散らばっていますが、これは恐ろしいことです。)

于 2013-01-16T14:11:38.057 に答える