跳至内容
菜单
此问题已终结
1 回复
9125 查看

Hi everybody,

I would like to know if it possible to concert bytea picture into binary. I take the bytea into a field of the database and i want to "put" it into a binary field like this:

cr.execute('SELECT res_company.logo_web FROM res_company') res = cr.fetchall() v['logo_Print'] =base64.decodestring(str(res[0]))

But doesn't work.

Someone have some idea, please? How is possible to concert my "tuple" into a string and after binary?

Thanks a lot!

Selverine

形象
丢弃
最佳答案

cr.fetchall() returns an array of arrays. If you cant to access the first column (logo_web) of the first row (I assume that there is only one row/company), then you have to use res[0][0].

形象
丢弃
编写者

Hi Andreas, Thank you for your help. It works!

相关帖文 回复 查看 活动
3
3月 15
21189
0
9月 18
2563
1
11月 24
796
2
4月 23
2745
1
12月 22
5073