|
verence
verence at web.de
Sun Jun 8 01:56:23 EST 2003
Dustin Mitchell wrote:
> On Sat, Jun 07, 2003 at 05:27:49PM +0200, martin voigt wrote:
>
>>hi *,
>>
>>how do i use a content handler to send binary data to the client? the write method supports only strings.
>
>
> Python holds arbitrary binary data in strings. So you can do, e.g.,
>
> data = open("my.gif", "r").read()
> req.content_type = 'image/gif'
> req.send_http_header()
> req.write(data)
>
> Dustin
>
thanks, shame on my, never tried the simplest one... :)
greets
|