win32 binary data manipulation in ASP

Joe Smith JoeSmith at bogusaddress.com
Sun Dec 19 22:12:04 EST 1999


I was using build 125 that I downloaded from the www.python.org site about 2
weeks ago.  So, I did not really think that there might be a new build or that
your site might be the one to look at.  I tried using the buffer(), but I guess
125 was not as good as 127.

Thanks.


Mark Hammond wrote:

> "Joe Smith" <JoeSmith at bogusaddress.com> wrote in message
> news:385CC64E.25E91136 at bogusaddress.com...
> >
> > I am trying to write a server side ASP script in python.
> >
> >     buffer = os.read(fd, numBytes)
> >     Response.BinaryWrite(buffer)
> >
> > I notice that I am getting exactly double the number of bytes on
> output.  I
> > suspect that the string returned from os.read() is getting converted
> to
> > unicode.
> >
> > I am looking for a way to convert the string to an array of bytes,
> not an array
> > of unicode characters.
>
> If you have build 127 of win32all, you can use a buffer object.  eg:
>
>    data = os.read(fd, numBytes)
>    Response.BinaryWrite(buffer(data))
>
> [ie, note that "buffer" is a Python builtin, so the variable name was
> changed]
>
> This also depends on ASP accepting data in this format - Im guessing
> it will, but I dont know for sure...
>
> Mark.




More information about the Python-list mailing list