我使用python3.5来完成这个任务+库fdb。我的剧本:
import fdb
con = fdb.connect(
host='host', database='database',
user='IAKUZNETSOV', password='111111'
)
cur = con.cursor()
cur.execute("select DATA from ATTACHMENTS where OID = '6512165313'")
fileToSave= cur.fetchone()[0]
with open('c:\\python5.jpg', 'wb') as f:
f.write(fileToSave)
尝试保存文件后,我收到错误:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 578: character maps to <undefined>
数据库中的编码字段:Win-1251类型:Blob。在
我怎样才能修好它?在
发生此错误是因为blob字段的子类型1(文本)。在
subtypes是:
如果不能将子类型更改为0,则可以尝试将数据转换为原始字节并将其转换为客户端应用程序。在
相关问题 更多 >
编程相关推荐