Hi - I have a script which instantiates a SimpleXMLRPCServer server and which I use to simulate a 'real server' when developing client scripts which will eventually get used with the 'real server'.
I would like to stop the script running in response to a CTRL-C. The script is run on windows. The script looks like this ... from SimpleXMLRPCServer import SimpleXMLRPCServer from SimulateCRRWebServices import SimulateCRRWebServices import signal import sys #Set up signal handler def signal_handler(signal, frame): print 'Closing down now' sys.exit(0) signal.signal(signal.SIGINT, signal_handler) #Set up XMLRPC Server server = SimpleXMLRPCServer(('localhost', 42001), logRequests=True) server.register_introspection_functions() server.register_multicall_functions() server.register_instance(SimulateCRRWebServices()) #Off we go ... print 'Use Control-C to exit' server.serve_forever() ... the trouble the script is unable to see my CTRL-C's ! As a reference I've written another script which *does* catch CTRL-C's ... import signal import sys def signal_handler(signal, frame): print 'You pressed Ctrl+C!' sys.exit(0) signal.signal(signal.SIGINT, signal_handler) print 'Press Ctrl+C' while True: continue ... so is there a way around this ? Be grateful for any advice. -- http://mail.python.org/mailman/listinfo/python-list