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

Exceptions lost from async_read_one #67

0xabu opened this issue Jun 15, 2017 · 1 comment

Exceptions lost from async_read_one #67

0xabu opened this issue Jun 15, 2017 · 1 comment


Copy link

@0xabu 0xabu commented Jun 15, 2017


I have a USB device which sometimes disappears unexpectedly for a few ms and I'm trying to handle this cleanly in application-level code -- similar to issue #64, I get an OSError back from a read call, and need to respond by closing and waiting to reopen the device.

I'm using async_read_one(). Unfortunately when the underlying (synchronous) read_one() call raises an exception, the exception leaks out of the future into the event loop. The fix that worked for me is to catch it and attach it to the future:

    def async_read_one(self):
        future = asyncio.Future()
        def read_next():
            except Exception as ex:
        return future

This comment has been minimized.

Copy link

@gvalkov gvalkov commented Jun 16, 2017

That's a good catch! Thanks - fixed in 388ce6f and released in evdev 0.7.0.

@gvalkov gvalkov closed this Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.