Open the file in binary mode -- so serving images from a Windows box

might actually work.
This commit is contained in:
Guido van Rossum 1998-12-07 03:53:18 +00:00
parent 08833f2a6d
commit 391c8b4ea2
1 changed files with 1 additions and 1 deletions

View File

@ -64,7 +64,7 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_error(403, "Directory listing not supported")
return None
try:
f = open(path)
f = open(path, 'rb')
except IOError:
self.send_error(404, "File not found")
return None