daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Nov 8th, 2018 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import signal
  2.  
  3. def handler(sig, frame):
  4.     print(sig)
  5.     raise KeyboardInterrupt
  6.  
  7. signal.signal(signal.SIGINT, handler) # press Ctrl+C to trigger handler
  8.  
  9. import sys
  10. if sys.platform == 'win32':
  11.     print('to observe effect, run py script interactively: python -i key.py')
  12. else:
  13.     "threading.Event does not work on windows"
  14.     import threading
  15.     forever = threading.Event()
  16.     forever.wait()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top