ASP Response.BinaryWrite in Python

Sam Sungshik Kong ssk at chol.nospam.net
Fri Jun 11 08:25:57 CEST 2004


Hello!

I'm writing ASP in Python.
I want to return an image stream from my ASP code
so that it will look like
<img src="image.asp">.

The problem is that Response.BinaryWrite only accepts SafeArray of Bytes as
parameter, if I understand it correctly.
How can I do it?

The example will be like this.

Response.Expires = 0
Response.Buffer = True
Response.Clear()
Response.ContentType = "image/gif"

Response.BinaryWrite(get_image()) #the function is below.

Response.End()
----------
def get_image():
 f = open(file_name, "rb")
 s = f.read()
 f.close()
 return s

Thanks in advance.

kong





More information about the Python-list mailing list