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

Got a traceback, then stopped registering key events #30

Closed
jave opened this issue Apr 4, 2024 · 5 comments
Closed

Got a traceback, then stopped registering key events #30

jave opened this issue Apr 4, 2024 · 5 comments

Comments

@jave
Copy link

jave commented Apr 4, 2024

$ inputscope
/home/joakim/.local/lib/python3.12/site-packages/inputscope/webui.py:233: DeprecationWarning: The default date converter is deprecated as of Python 3.12; see the sqlite3 documentation for suggested replacement recipes
for e in events:
/home/joakim/.local/lib/python3.12/site-packages/inputscope/webui.py:313: DeprecationWarning: The default date converter is deprecated as of Python 3.12; see the sqlite3 documentation for suggested replacement recipes
for e in events:
Unhandled exception in listener callback
Traceback (most recent call last):
File "/home/joakim/.local/lib/python3.12/site-packages/pynput/_util/init.py", line 228, in inner
return f(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joakim/.local/lib/python3.12/site-packages/pynput/_util/xorg.py", line 470, in _handler
self._handle(self._display_stop, event)
File "/home/joakim/.local/lib/python3.12/site-packages/pynput/keyboard/_xorg.py", line 564, in _handle
self.on_press(key)
File "/home/joakim/.local/lib/python3.12/site-packages/pynput/_util/init.py", line 144, in inner
if f(*args) is False:
^^^^^^^^
File "/home/joakim/.local/lib/python3.12/site-packages/inputscope/listener.py", line 475, in
args = dict(on_press= lambda k, *a, **kw: self.on_event(True, k),
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joakim/.local/lib/python3.12/site-packages/inputscope/listener.py", line 487, in on_event
mykey, realkey = self.extract(key)
^^^^^^^^^^^^^^^^^
File "/home/joakim/.local/lib/python3.12/site-packages/inputscope/listener.py", line 526, in extract
elif ord("A") <= vk <= ord("Z") or ord("0") <= vk <= ord("9"):
^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<=' not supported between instances of 'int' and 'NoneType'

@jave
Copy link
Author

jave commented Apr 4, 2024

I can reproduce this when I press a key on the numpad

@jave
Copy link
Author

jave commented Apr 8, 2024

the keycodes I get in X doesnt seem to match the keycodes in the source.

xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'

90 KP_0
91 KP_Separator
104 KP_Enter
87 KP_1
88 KP_2
89 KP_3
83 KP_4
84 KP_5
85 KP_6
79 KP_7
80 KP_8
81 KP_9
82 KP_Subtract
86 KP_Add
77 Num_Lock
106 KP_Divide
63 KP_Multiply
133 Super_L
50 Shift_L

in https://github.com/suurjaak/InputScope/blob/master/src/inputscope/listener.py

     96: "Numpad0",
     97: "Numpad1",
     98: "Numpad2",
     99: "Numpad3",
    100: "Numpad4",
    101: "Numpad5",
    102: "Numpad6",
    103: "Numpad7",
    104: "Numpad8",
    105: "Numpad9",

     12: "Numpad-Clear", # Numpad5 without NumLock
    106: "Numpad-Multiply",
    107: "Numpad-Add",
    109: "Numpad-Subtract",
    110: "Numpad-Delete",
    111: "Numpad-Divide",

So I seem to get a traceback for a keycode not mentioned in the src. KP_ENTER is 104 on X aparently, and 104 in src in Numpad8, and I dont get a crash. But KP_0 is 90, and that doesnt have a src mapping, and then it crashes.

Or so it would appear...

@suurjaak
Copy link
Owner

suurjaak commented Apr 9, 2024

The deprecation warning will be easy to fix, and I will do so in the next release.

But it looks like there is a bigger problem. Are you using Ubuntu 24? Seems that there have been a number of breaking changes, and the library used for monitoring user inputs is not compatible with the newest things, and the library author is not actively developing it any more.

I'll have to set up a virtual machine with ubuntu24 and experiment.

@jave
Copy link
Author

jave commented Apr 9, 2024

No Im using fedora 39. Thanks for having a look!

@suurjaak
Copy link
Owner

The new v1.11 release should fix these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants