[Image-SIG] StringIO seems to garble images in cgi
Sun, 8 Dec 2002 23:39:57 +0100
On vrijdag, dec 6, 2002, at 22:43 Europe/Amsterdam,
> The following almost works, unfortunately the image comes out garbled.
> have tried a variety of images in case they are somehow corrupt- no
> dice. Am
> I missing a step?
As you're using normal write() calls to sys.stdout you'll be messing up
your \r and \n bytes in the image: sys.stdout is a text-mode file so
you can't write binary data to it. At least: not on Windows. You'll
have to somehow reopen the file in binary mode, but whether the unix
fp = os.fdopen(sys.stdout.fileno(), 'wb')
works on Windows remains to be seen...
- Jack Jansen <Jack.Jansen@oratrix.com>
- If I can't dance I don't want to be part of your revolution -- Emma