【发布时间】:2019-10-15 12:04:05
【问题描述】:
我正在尝试在我的 python 代码中使用 swiftclient 将 sqlite.db(二进制文件)上传到 swift 容器。
导入 swiftclient swift_conn.put_object
文件“/usr/lib/python3.7/codecs.py”,第 322 行,在解码中 (结果,消耗)= self._buffer_decode(数据,self.errors,最终) UnicodeDecodeError:“utf-8”编解码器无法解码位置 43 中的字节 0xbc:无效的起始字节
我使用的代码是:
import swiftclient
bmdatabase = "./logs/test.db'
with open(bmdatabase, 'r') as bmdatabase_file:
#remote
correctbmdatabasename = bmdatabase.replace("./logs/", "")
swift_conn.put_object(container_name,correctbmdatabasename,
contents=bmdatabase_file.read())
【问题讨论】:
标签: python swift python-3.x openstack openstack-swift