stopping SimpleHTTPServer

dsavitsk dsavitsk at e-coli.net
Tue Nov 19 11:28:39 EST 2002


"François Pinard" <pinard at iro.umontreal.ca> wrote in message
news:mailman.1037712456.9562.python-list at python.org...
> [dsavitsk]
>
> > I have an application built on BaseHTTPServer.

* * *

> >  The problem I am having is that I can't kill
> > it remotely.  I put in a sys.exit(), but that didn't do any good. Can
> > anyone suggest a good way?  Actually, I would like a way to kill it
> > from a command line as well.
>
> One may use some special URLs as triggers to the server.  In more complex
> applications, you might combine the above idea with HTML forms meant to
> drive the server itself.
>
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

----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 1118)
Traceback (most recent call last):
  File "C:\Python\lib\SocketServer.py", line 221, in handle_request
    self.process_request(request, client_address)
  File "C:\Python\lib\SocketServer.py", line 240, in process_request
    self.finish_request(request, client_address)
  File "C:\Python\lib\SocketServer.py", line 253, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python\lib\SocketServer.py", line 501, in __init__
    self.handle()
  File "C:\Python\lib\BaseHTTPServer.py", line 266, in handle
    method()
  File "C:\ecp\Script1.py", line 39, in do_GET
    f = self.process_command()
  File "C:\ecp\Script1.py", line 55, in process_command
    sys.exit(1)
SystemExit: 1
----------------------------------------

?





More information about the Python-list mailing list