On Mon, 17 May 2010 20:34:21 +0200 Dodo <dodo_do_not_wake...@yahoo.fr> wrote:
> Let's consider this code: > > #!/usr/bin/python3 > import cgi, sys > print("Content-type:image/jpeg\n\n") print() adds an additional \n, so there's one too many. Also, HTTP headers should be separated with \r\n, not \n. (besides, under Windows \n will be converted to \r\n by the text I/O layer, therefore, it would be better to use the binary I/O layer, a.k.a sys.stdout.buffer, if you want your script to be portable) Therefore, I would advocate rewriting it as: sys.stdout.buffer.write(b"Content-type:image/jpeg\r\n\r\n") -- http://mail.python.org/mailman/listinfo/python-list