Skip to Content
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
9124 Представления

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!

Related Posts Ответы Просмотры Активность
3
мар. 15
21186
0
сент. 18
2563
1
нояб. 24
796
2
апр. 23
2745
1
дек. 22
5073