def func():
try:
raise KeyboardInterrupt
except Exception as e:
pass
func()
Traceback (most recent call last):
File "/home/user/Рабочий стол/file.py", line 7, in <module>
func()
File "/home/user/Рабочий стол/file.py", line 3, in func
raise KeyboardInterrupt
KeyboardInterrupt