On Sun, Jun 10, 2018 at 7:06 PM, Marko Rauhamaa <ma...@pacujo.net> wrote: > Chris Angelico <ros...@gmail.com>: >> It's important to pin down the true cause of the problem, and not >> blame something for doing the proper Pythonic thing. > > So could you tell me what the proper Pythonic fix for the example server > in Python's documentation would be? > > Here's the code in question: > > ======================================================================== > import http.server > import socketserver > > PORT = 8000 > > Handler = http.server.SimpleHTTPRequestHandler > > with socketserver.TCPServer(("", PORT), Handler) as httpd: > print("serving at port", PORT) > httpd.serve_forever() > ======================================================================== > > BTW, the proper response would be a 404. 500 means: "There's a bug in my > code". >
The fix is a pull request against serve_forever to catch exceptions and return 500s. ChrisA -- https://mail.python.org/mailman/listinfo/python-list