stopping SimpleHTTPServer

Alex Martelli aleax at aleax.it
Tue Nov 19 11:12:16 EST 2002


dsavitsk wrote:
   ...
> I think I didn't ask a very clear question.  I tried to have a special url
> cause a function to be called which kills the server.  The problem is that
> sys.exit() didn't manage to bring it down ... it gave this traceback
> instead

In your subclass, you need to override method handle_error, which by
default processes all exceptions (including the SystemExit exception
raised by sys.exit) by printing a traceback and continuing.  Check if
the exception is SystemExit and then re-raise it, otherwise delegate
to your base-class's handle_error for normal error processing...


Alex




More information about the Python-list mailing list