timeyyy / system_hotkey

system wide hotkeys
BSD 3-Clause "New" or "Revised" License
44 stars 19 forks source link

InvalidKeyError is cannot be caught via try-except block #24

Open jezztify opened 2 years ago

jezztify commented 2 years ago
import sys
from system_hotkey import SystemHotkey, InvalidKeyError
try:
        hk = SystemHotkey()
        hk.register(["alt","q'"], callback=lambda event: overlay.quit())
except InvalidKeyError:
        sys.exit()
print('IT WENT HERE')

above code will continue and will not execute sys.exit()