gliderlabs/docker-alpine
Ver no GitHubPython2 cannot read keyboard input device
Open
#206 aberto em 22 de ago. de 2016
help wantedquestion
Métricas do repositório
- Stars
- (5.391 stars)
- Métricas de merge de PR
- (Nenhuma PRs mesclada em 30d)
Description
I'm trying to read usb keyboard inside alpine docker container.
Run container
# docker run --privileged --rm -it -v /dev/input:/dev/input alpine sh
/ # ls /dev/input/by-path/
pci-0000:00:01.2-usb-0:1:1.0-event-mouse platform-i8042-serio-1-event-mouse
pci-0000:00:01.2-usb-0:1:1.0-mouse platform-i8042-serio-1-mouse
platform-i8042-serio-0-event-kbd platform-pcspkr-event-spkr
Run python2 (Raise error)
/ # apk add -U python
/ # python
Python 2.7.12 (default, Jun 29 2016, 08:57:23)
[GCC 5.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> kbd = open('/dev/input/by-path/platform-i8042-serio-0-event-kbd', 'rb')
>>> kbd.read(16)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 22] Invalid argument
>>> exit()
Run python3 (No error)
/ # apk add python3
/ # python3
Python 3.5.1 (default, May 30 2016, 16:01:04)
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> kbd = open('/dev/input/by-path/platform-i8042-serio-0-event-kbd', 'rb')
>>> kbd.read(16)
^C