-
Notifications
You must be signed in to change notification settings - Fork 434
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
Ubuntu Linux: Listening to on_release events getting OSError: [Errno 19] No such device #397
Comments
I am getting this error after 1-2 hour or so of listening on a keyboard event. Exception in thread Thread-18: |
@marcel-valdez I think that's what I'm getting as well. Thanks for posting the full traceback. |
I figured out when/why this happens. If your keyboard disconnects even for a fraction of a second the event polling code thinks the device no longer exists and when it tries to fetch the event, it throws exception and fails. My keyboard has a faulty cable which at times loses the connection for an unnoticeable amount of time, but the code manages to attempt to poll my (disconnected) keyboard for that moment and throws exception. To test, do the following:
|
Figured out a fix for the issue. Will post pull request. |
@marcel-valdez Awesome that you figured it out! Yeah, I think my keyboard might also have an issue. (Or maybe it's something related as the disconnect seems to happen more often when the screen is locked.) |
…cted momentarily. I encountered the issue in a *nix machine (Ubuntu 16.04). The fix makes it so that we don't ready the input file when a keyboard is disconnected by checking the 'readable()' method on the file pointer, in Ubuntu when the keyboard is re-connected the 'readable()' method returns True and everything works as usual.
…cted momentarily. I encountered the issue in a *nix machine (Ubuntu 16.04). The fix makes it so that we don't ready the input file when a keyboard is disconnected by checking the 'readable()' method on the file pointer, in Ubuntu when the keyboard is re-connected the 'readable()' method returns True and everything works as usual.
update: |
hi! im having the same problem, i forked the repo and download the code in order to debug it but if the connection is lost the readable() method is still returning True, so the error hangs the script... is there any workaround or way to raise the error to the main thread and stopped all in order to catch the exception and relaunch or something, now even if a wrap the code into a try/except the exception is printed but not raised and the program is hanged thx! |
…cted momentarily. I encountered the issue in a *nix machine (Ubuntu 16.04). The fix makes it so that we don't ready the input file when a keyboard is disconnected by checking the 'readable()' method on the file pointer, in Ubuntu when the keyboard is re-connected the 'readable()' method returns True and everything works as usual.
#642 should fix the issue |
Thanks for this library!
I'm using it to listen to every
on_release
event:But sadly after a while I always get this exception:
After that, the callback isn't called anymore.
Edit: Actually, sometimes it happens right away..
The text was updated successfully, but these errors were encountered: