I have a simply code:
import eventlet
def execute():
print("Start")
timeout = Timeout(3)
try:
print("First")
sleep(4)
print("Second")
except:
raise TimeoutException("Error")
finally:
timeout.cancel()
print("Third")
这段代码应该抛出TimeoutException,因为“try”块中的代码执行时间超过3秒。但是这个异常在循环中被吞噬了,输出中看不到它。
以下为输出内容:
Start
First
Process finished with exit code 0
我该如何将这个异常输出?