I was hoping that putting 'sys.exit(1)' and catching it later like this will work.
xml_open()
try:
run(reloader=True, host='localhost', port=8080)
except SystemExit:
xml_save()
print "Exited ..."
Is there any other solution to exit these python micro-frameworks to exit from inside the handlers ?
If its not being handled then check whether Its really executes sys.exist(1) statement, because It may happen some other exception raised which is not being handled try this....
xml_open()
try:
run(reloader=True, host='localhost', port=8080)
except SystemExit:
xml_save()
print "Exited ..."
except Exception, e:
print "ohhh no.......",str(e)
import pdb
pdb.post_mortem()
sys.exit(-1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With