Google 在开发服务器上的文件名中使用与符号 (&) 时出现云存储错误
Google Cloud Storage Error When Using Ampersand (&) in Filename on Dev Server
在开发服务器上使用 Google Cloud Storage Python Client API 保存文件时,文件名中包含 & 符号,API 会抛出错误.
cloud storage documentation on filenames 没有说明不能在文件名中使用 & 符号。这是 Google 云存储 Python API 的错误还是我做错了什么?
我的代码,差不多:
import cloudstorage
f = cloudstorage.open("/my_bucket/my&file.txt", "w")
f.write("foo")
f.close()
我得到的回溯(部分编辑):
Traceback (most recent call last):
...
f.close();
File "libs\cloudstorage\storage_api.py", line 787, in close
self._flush(finish=True)
File "libs\cloudstorage\storage_api.py", line 841, in _flush
self._send_data(data, self._written, file_len)
File "libs\cloudstorage\storage_api.py", line 874, in _send_data
{'upload_path': self._path_with_token})
File "libs\cloudstorage\errors.py", line 141, in check_status
raise ServerError(msg)
ServerError: Expect status [200] from Google Storage. But got status 500.
Path: ...
Request headers: {'accept-encoding': 'gzip, *', 'x-goog-api-version': '2', 'content-range': 'bytes 0-2/3'}.
Response headers: {'server': 'Development/2.0', 'transfer-encoding': 'chunked', 'date': 'Mon, 27 Jul 2015 00:42:29 GMT'}.
Body: ''.
Extra info: {'upload_path': '...'}.
如果这是一个错误,我会感到惊讶。这看起来就像一个体面的测试套件会检查的东西类型。
为了后代:有一个类似的问题,除了文件名中没有符号。解决它的方法是清除作为 --storage_path
传递给 dev_appserver.py
的文件夹的内容(或者如果它不存在则添加它,即:/path/to/appengine/dev_appserver.py --storage_path=~/tmp
)
此问题的可能来源:https://code.google.com/p/googleappengine/issues/detail?id=12976 - 以上内容可作为快速修复
在开发服务器上使用 Google Cloud Storage Python Client API 保存文件时,文件名中包含 & 符号,API 会抛出错误.
cloud storage documentation on filenames 没有说明不能在文件名中使用 & 符号。这是 Google 云存储 Python API 的错误还是我做错了什么?
我的代码,差不多:
import cloudstorage
f = cloudstorage.open("/my_bucket/my&file.txt", "w")
f.write("foo")
f.close()
我得到的回溯(部分编辑):
Traceback (most recent call last):
...
f.close();
File "libs\cloudstorage\storage_api.py", line 787, in close
self._flush(finish=True)
File "libs\cloudstorage\storage_api.py", line 841, in _flush
self._send_data(data, self._written, file_len)
File "libs\cloudstorage\storage_api.py", line 874, in _send_data
{'upload_path': self._path_with_token})
File "libs\cloudstorage\errors.py", line 141, in check_status
raise ServerError(msg)
ServerError: Expect status [200] from Google Storage. But got status 500.
Path: ...
Request headers: {'accept-encoding': 'gzip, *', 'x-goog-api-version': '2', 'content-range': 'bytes 0-2/3'}.
Response headers: {'server': 'Development/2.0', 'transfer-encoding': 'chunked', 'date': 'Mon, 27 Jul 2015 00:42:29 GMT'}.
Body: ''.
Extra info: {'upload_path': '...'}.
如果这是一个错误,我会感到惊讶。这看起来就像一个体面的测试套件会检查的东西类型。
为了后代:有一个类似的问题,除了文件名中没有符号。解决它的方法是清除作为 --storage_path
传递给 dev_appserver.py
的文件夹的内容(或者如果它不存在则添加它,即:/path/to/appengine/dev_appserver.py --storage_path=~/tmp
)
此问题的可能来源:https://code.google.com/p/googleappengine/issues/detail?id=12976 - 以上内容可作为快速修复