ev3dev / ev3dev-lang

(deprecated) language bindings for ev3dev sensors, motors, LEDs, etc.
GNU General Public License v2.0
56 stars 39 forks source link

Buttons Error (platform-gpio-keys.0-event not found) #182

Closed laurensvalk closed 6 years ago

laurensvalk commented 6 years ago

It appears that Buttons do not work.

I'm using the latest ev3dev stretch on my ev3, with no modifications/additional installs.

Possibly similar to this, but the error looks different.

Traceback (most recent call last):
  File "/home/robot/testing/prog.py", line 4, in <module>
    btn = ev3.Button()
  File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 2554, in __init__
    self._file_cache[name] = open(name, 'rb', 0)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/input/by-path/platform-gpio-keys.0-event'

Minimum example, copied from here.

#!/usr/bin/env python3
import ev3dev.ev3 as ev3

btn = ev3.Button()
# Is 'Left' button pressed?
print('yes' if btn.left else 'no')

# Check if any buttons are pressed:
print('yes' if btn.any() else 'no')
laurensvalk commented 6 years ago

I've posted this in the wrong place. I'll repost in ev3dev-lang-python.

ddemidov commented 6 years ago

This should be fixed by #181 (but is not yet published as a package).

laurensvalk commented 6 years ago

Ok, great!