how to make a SimpleXMLRPCServer abort at CTRL-C under windows
Frank Millman
frank at chagford.com
Fri Feb 12 01:59:54 EST 2010
"Aahz" <aahz at pythoncraft.com> wrote in message
news:hl2ob2$3ib$1 at panix5.panix.com...
> In article <mailman.2077.1265524158.28905.python-list at python.org>,
> Gabriel Genellina <gagsl-py2 at yahoo.com.ar> 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)
httpd.serve_forever()
try:
while True:
sleep(1)
except KeyboardInterrupt:
httpd.shutdown()
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.
HTH
Frank Millman
More information about the Python-list
mailing list