Hi Ian,
You are correct - I missed the following 2 nuances:
# need to set poll_interval in order to recognize shutdown request
httpd.serve_forever(poll_interval=0.5)
# shutdown request must be initiated from ANOTHER thread or will block
import threading
threading.Thread(target=httpd.shutdown).st
On 12/27/2010 6:05 PM, pyt...@bdurham.com wrote:
Is it possible to programmatically exit from the wsgiref's
serve_forever() loop?
I tried the following, all without success:
httpd.server_close()
httpd.shutdown()
sys.exit(1)
os._exit(1) (shouldn't this always abort an application?)
raise KeyboardI
Is it possible to programmatically exit from the wsgiref's
serve_forever() loop?
I tried the following, all without success:
httpd.server_close()
httpd.shutdown()
sys.exit(1)
os._exit(1) (shouldn't this always abort an application?)
raise KeyboardInterupt (Ctrl+Break from console works)
Thanks