Python3 buffer extra byte??

2010-05-17 Thread Dodo
Let's consider this code: #!/usr/bin/python3 import cgi, sys print(Content-type:image/jpeg\n\n) f = open(img.jpg,rb) sys.stdout.flush() sys.stdout.buffer.write( f.read() ) f.close() I receive the file with one padding byte at the start of the file (0x0a)

Re: Python3 buffer extra byte??

2010-05-17 Thread Antoine Pitrou
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.