Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'AttrbuteError' in Python 3.10 #29

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions system_hotkey/system_hotkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
import queue
import time
import collections

try:
Iterable = collections.abc.Iterable
except AttributeError:
Iterable = collections.Iterable

from pprint import pprint
import struct

Expand Down Expand Up @@ -125,10 +131,13 @@ class InvalidKeyError(SystemHotkeyError):pass
, "f23": win32con.VK_F23
, "f24": win32con.VK_F24
, "media_play_pause": win32con.VK_MEDIA_PLAY_PAUSE
, "media_stop": win32con.VK_MEDIA_STOP
, "media_next": win32con.VK_MEDIA_NEXT_TRACK
, "media_previous": win32con.VK_MEDIA_PREV_TRACK
}

if hasattr(win32con, 'VK_MEDIA_STOP'):
vk_codes.setdefault("media_stop", win32con.VK_MEDIA_STOP)

win_modders = {
"shift": win32con.MOD_SHIFT
,"control": win32con.MOD_CONTROL
Expand Down Expand Up @@ -285,7 +294,7 @@ def register(self, hotkey, *args, callback=None, overwrite=False):

thread safe
'''
assert isinstance(hotkey, collections.Iterable) and type(hotkey) not in (str, bytes)
assert isinstance(hotkey, Iterable) and type(hotkey) not in (str, bytes)
if self.consumer == 'callback' and not callback:
raise TypeError('Function register requires callback argument in non sonsumer mode')

Expand Down