Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
9413 Ansichten

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
Verwerfen
Beste Antwort

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
Verwerfen
Autor

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

Verknüpfte Beiträge Antworten Ansichten Aktivität
3
März 15
21401
0
Sept. 18
2742
1
Nov. 24
1043
2
Apr. 23
2958
1
Dez. 22
5340