How to silent/quiet HTTPServer and BasicHTTPRequestHandler's stderr output? How to silent/quiet HTTPServer and BasicHTTPRequestHandler's stderr output? python python

How to silent/quiet HTTPServer and BasicHTTPRequestHandler's stderr output?


This will probably do it:

from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandlerclass MyHandler(BaseHTTPRequestHandler):    def do_GET(self):        self.send_response(200)        self.send_header('Content-type', 'text/html')        self.end_headers()        self.wfile.write('<html><body><p>OK</p></body></html>')    def log_message(self, format, *args):        returnhttpd = HTTPServer(('', 8001), MyHandler)httpd.serve_forever()