将 blob 写入 blobstore
我尝试使用此处描述的方法写入 blobstore:
http ://code.google.com/appengine/docs/python/blobstore/overview.html#Writing_Files_to_the_Blobstore
我尝试使用remote_api来执行以下代码:
file_name = files.blobstore.create(mime_type='text/html',_blobinfo_uploaded_filename='sample.txt')
with files.open(file_name, 'a') as f:
f.write('sample text for the sample blob')
files.finalize(file_name)
总是会引发错误(在上面的第三行):
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\file
s\file.py", line 310, in write
self._make_rpc_call_with_retry('Append', request, response)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\file
s\file.py", line 388, in _make_rpc_call_with_retry
_make_call(method, request, response)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\file
s\file.py", line 236, in _make_call
_raise_app_error(e)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\file
s\file.py", line 179, in _raise_app_error
raise FileNotOpenedError()
FileNotOpenedError
我尝试写入的文件非常小(< 20KB),因此它不是配额问题。我还缺少其他步骤吗?
I am trying to write to the blobstore using the method described here:
http://code.google.com/appengine/docs/python/blobstore/overview.html#Writing_Files_to_the_Blobstore
I tried using the remote_api to execute the following code:
file_name = files.blobstore.create(mime_type='text/html',_blobinfo_uploaded_filename='sample.txt')
with files.open(file_name, 'a') as f:
f.write('sample text for the sample blob')
files.finalize(file_name)
invariably raises the error (at the third line above):
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\file
s\file.py", line 310, in write
self._make_rpc_call_with_retry('Append', request, response)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\file
s\file.py", line 388, in _make_rpc_call_with_retry
_make_call(method, request, response)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\file
s\file.py", line 236, in _make_call
_raise_app_error(e)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\file
s\file.py", line 179, in _raise_app_error
raise FileNotOpenedError()
FileNotOpenedError
The file i am trying to write is very small (< 20KB) so its not a quota issue. Are there additional steps i am missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您可能需要添加以下模块,但如果您之前没有添加。
maybe you can need to add below module but if you dont previously add.