Ant wrote: ... > OK, I've narrowed the problem back to the way HTTPServer (actually its > TCPServer parent) handles exceptions thrown by the process_request > method by catching them all, and then calling a handle_error method. > There doesn't seem to be a way of getting at the exception thrown > however - does anyone know how I can get this information?
Hmm. Lonely topic ;-) I've found a way to solve the problem, by creating a subclass of HTTPServer which overrides the handle_error method: class HelpServer(HTTPServer): def handle_error(self, request, client_address): exception_line = inspect.trace()[-1][-2][0] if "sys.exit" in exception_line: print "Trying to exit again!" sys.exit(0) else: HTTPServer.handle_error(self, request, client_address) This seems a really nasty hack though - any ideas for a cleaner way to do it? -- http://mail.python.org/mailman/listinfo/python-list