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

examples/7color/buttons.py doesn't stop cleanly #215

Open
dolmen opened this issue Mar 18, 2025 · 0 comments
Open

examples/7color/buttons.py doesn't stop cleanly #215

dolmen opened this issue Mar 18, 2025 · 0 comments

Comments

@dolmen
Copy link

dolmen commented Mar 18, 2025

examples/7color/buttons.py crashes with a stacktrace when the program is interrupted with Ctrl+C. I expected a clean exit, so exception KeyboardInterrupt should be caught.

$ ./buttons.py 
buttons.py - Detect which button has been pressed

This example should demonstrate how to:
 1. set up gpiod to read buttons,
 2. determine which button has been pressed

Press Ctrl+C to exit!


Button press detected on GPIO #5 label: A
Button press detected on GPIO #6 label: B
Button press detected on GPIO #16 label: C
Button press detected on GPIO #24 label: D
Button press detected on GPIO #24 label: D
^CTraceback (most recent call last):
  File "/home/dolmen/Pimoroni/inky/examples/7color/./buttons.py", line 62, in <module>
    for event in request.read_edge_events():
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dolmen/.virtualenvs/pimoroni/lib/python3.11/site-packages/gpiod/line_request.py", line 223, in read_edge_events
    return cast(_ext.Request, self._req).read_edge_events(max_events)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
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

1 participant