我正在尝试让键盘库在 Chromebook 上运行。我处于开发人员模式,并且以 root 身份运行 Python。当我尝试在没有 root 的情况下运行它时,它说我“必须是 root 才能在 linux 上使用这个库”。
当我运行时keyboard.write("word")
,它给了我这个错误。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/dist-packages/keyboard/__init__.py", line 854, in write
scan_code, modifiers = next(iter(entries))
File "/usr/local/lib/python3.7/dist-packages/keyboard/_nixkeyboard.py", line 148, in map_name
build_tables()
File "/usr/local/lib/python3.7/dist-packages/keyboard/_nixkeyboard.py", line 73, in build_tables
dump = check_output(['dumpkeys', '--keys-only'], universal_newlines=True)
File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/usr/lib/python3.7/subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['dumpkeys', '--keys-only']' returned non-zero exit status 1.```