how to make a SimpleXMLRPCServer abort at CTRL-C under windows

Frank Millman frank at
Fri Feb 12 07:59:54 CET 2010

"Aahz" <aahz at> wrote in message 
news:hl2ob2$3ib$1 at
> In article <mailman.2077.1265524158.28905.python-list at>,
> Gabriel Genellina <gagsl-py2 at> wrote:
>>Strange. With Python 2.6.4 I don't need to do that; I'd say the difference
>>is in the OS or antivirus (some AV are known to break the TCP stack).
> Perhaps, but I've also found that ctrl-C doesn't work on Windows.

I don't know if this is exactly the same, but FWIW ...

I had the following, in a test program -

    from wsgiref.simple_server import make_server

    myserver = MyServer()
    httpd = make_server('', 7789, myserver)

        while True:
    except KeyboardInterrupt:

I could not get it to respond to Ctrl-C.

Then I read somewhere that it must run in a separate thread, so I changed it 
like this -

-   httpd.serve_forever()
+   threading.Thread(target=httpd.serve_forever).start()

Now it does respond to Ctrl-C.


Frank Millman

More information about the Python-list mailing list