Why can't I use keyboard module?
I wanted to make some hotkeys. so I found out about keyboard and it's useful feature that detects keypress which I really wanted.
Then I tried importing it, first it took A LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG TIME to load!
And then it said an error message
Hi! Can you please show us the error?
The problem with the keyboard
module is always a never-solved problem with Repl. Seriously, try it on your local machine is a much better choice.
@Wumi4 okay, is there a alternative
that can help me detect a key-press?
it shows me this error..."
Traceback (most recent call last):
File "main.py", line 1, in
import pynput
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pynput/init.py", line 40, in
from . import keyboard
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pynput/keyboard/init.py", line 31, in
backend = backend(name)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pynput/_util/init.py", line 76, in backend
raise ImportError('this platform is not supported: {}'.format(
ImportError: this platform is not supported: ("failed to acquire X connection: No module named 'Xlib'", ModuleNotFoundError("No module named 'Xlib'"))
Try one of the following resolutions:
- Please make sure that you have an X server running, and that the DISPLAY environment variable is set correctly"
What language? (I'm not very skilled don't judge)
@M07 oh sorry I forgot to mention, it is python
@M07 nah at this point anything will help
You need root to use the keyboard module... and that's a thing you can't do on repl.it. You can't be root.
I don't think replit supports it, I would look into getch
Oh, well, because it is python, you might want to use the
getch
module or maybe as Wumi4 said, usepynput
?