Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
9599 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

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].

Avatar
Zrušit
Autor

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

Related Posts Odpovědi Zobrazení Aktivita
3
bře 15
21717
0
zář 18
2884
1
lis 24
1267
2
dub 23
3114
1
pro 22
5569