title: Python cant serve mp4 to browser
body: <p>Im trying to serve a video file from my home WAMP server (windows 8) to the browser, but the browser keeps giving an error 500, and the apache logs says malformed header from script 's.py': Bad header: G@</p>
  
  <p>"s.py" is my python version 3.4 script</p>
  
  <pre><code>n="\\wamp\\www\\r.mp4"
  print ("Last-Modified: Fri, 24 Apr 2015 22:09:52 GMT")
  print ("Accept-Ranges: bytes")
  print ("Content-Length:", os.path.getsize(n))
  print ("Content-type: video/mp4\r\n\r\n")
  
  f=open(n, 'rb')
  d=f.read()
  sys.stdout.buffer.write(d)
  sys.stdout.flush()
  f.close()
  </code></pre>
  
  <p>i can run other simple python scripts on the server using the browser, so i know thats working, but for some reason it wont serve this mp4 file.</p>
  
  <p>in the browser i call it using the URL "localhost/s.py", then it just gives error 500, and server log shows malformed header.</p>
  
  <p>I been working on it all day, anybody have any idea how to solve it, </p>
  
  <p>Thanks</p>