Suppressing "KeyboardInterrupt" Message on Python Script
Talles L

Talles L @tallesl

About: nothing to see here, move along

Location:
Brazil
Joined:
Jul 12, 2020

Suppressing "KeyboardInterrupt" Message on Python Script

Publish Date: Dec 1 '24
0 0
from signal import signal, SIGINT
signal(SIGINT, lambda _, __: exit())

print('No message or stack trace will be printed when you Ctrl+C this program.')

from time import sleep
sleep(999999999)
Enter fullscreen mode Exit fullscreen mode

Comments 0 total

    Add comment