[Image-SIG] StringIO seems to garble images in cgi
Georg Mischler
schorsch@schorsch.com
Sun, 8 Dec 2002 09:06:48 -0500 (EST)
Fredrik Lundh wrote:
> Georg Mischler wrote:
>
> > > > try:
> > > > print 'Content-Type: image/jpeg\n'
> >
> >
> > Another possibility is that the missing second '\n' here
> > causes the server to send garbage. You need an empty line
> > between the HTTP headers and the data.
>
> but the print statement adds an extra newline by
> itself, right?
There's a point to that...
I got confused by the mixed use of print and sys.stdout.write.
But then, maybe Python got confused by the same thing, as was
mentioned earlier about the -u parameter in the hashbang.
I'd recommend not to mix those two, just to be on the safe side.
-schorsch
--
Georg Mischler -- simulations developer -- schorsch at schorsch.com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/