用raise语句替换break语句,如下所示:
while True:
try:
if subprocess_cnt <= max_subprocess:
try:
notifier.process_events()
if notifier.check_events():
notifier.read_events()
except KeyboardInterrupt:
notifier.stop()
print 'KeyboardInterrupt caught'
raise # the exception is re-raised to be caught by the outer try block
else:
pass
except (KeyboardInterrupt, SystemExit):
print '\nkeyboardinterrupt caught (again)'
print '\n...Program Stopped Manually!'
raise
except块中的两个print语句应该以'(再次)’出现的第二个执行.