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

Error when running keyboard-test.py on 1.8.0 #633

Open
ryankanno opened this issue Mar 8, 2025 · 2 comments
Open

Error when running keyboard-test.py on 1.8.0 #633

ryankanno opened this issue Mar 8, 2025 · 2 comments

Comments

@ryankanno
Copy link

Description

I am getting an AttributeError: 'Listener' object has no attribute '_handle'. Did you mean: '_handler'? when running tools/keyboard-test.py.

It looks to be throwing here: File "pynput/_util/xorg.py", line 473, in _handler
self._handle(self._display_stop, event, injected)

Platform and pynput version

I am running Ubuntu 24.04.2 LTS (x11) with pynput 1.8.0 using python 3.11.6 along with 3.13.0rc2.

To Reproduce
Copied and pasted keyboard-test.py into a file and ran it locally.

I took a peek at the history of the file, and noticed that this commit renamed _handle and this commit added it back in. I didn't dive in too deep, but commenting out 472 does appear to fix the issue.

As a note, uv add pynput==1.7.8 also fixes the issue for me on 3.11.6 and 3.13.0rc2.

@ryankanno ryankanno changed the title Error when running Error when running keyboard-test.py on 1.8.0 Mar 8, 2025
@scotthaleen
Copy link

same issue

Python 3.12.5
Ubuntu 22.04.5 LTS
pynput 1.8.0

@furas
Copy link

furas commented Mar 10, 2025

I have the same problem on Linux Mint 22, Python 3.11 and 3.13, pynput 1.8.0

Code works if I remove line

self._handle(self._display_stop, event, injected)

I think it is mistake because next line is very similar

self._handle_message(self._display_stop, event, injected)

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

3 participants