Currently, I have written a code for a voice assistant which can write with users voice. I use python keyboard module from pip. But when I execute the code it shows me that it cannot write without root.
the code is given below,
elif (t.find("type") != -1):
le = t.find("type") + len("type") + 1
t = t[le:]
try:
print("Typing> ", t)
keyboard.write('' + t+". ")
except:
print("Can't Type")
No, you cannot read or write using the keyboard module unless you are root. I have had the same problem, sadly. But Pynput worked perfectly using the pynput.keyboard.Listener class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With