Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
223 views
in Technique[技术] by (71.8m points)

android - Getting Error on using keyboard module and writing command in pydroid3

code

import keyboard as k k.press("ctrl+j")

Error

Traceback (most recent call last): File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in start(fakepyfile,mainpyfile) File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start exec(open(mainpyfile).read(), main.dict) File "", line 4, in File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/keyboard/init.py", line 396, in press send(hotkey, True, False) File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/keyboard/init.py", line 379, in send parsed = parse_hotkey(hotkey) File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/keyboard/init.py", line 358, in parse_hotkey steps.append(tuple(key_to_scan_codes(key) for key in keys)) File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/keyboard/init.py", line 358, in steps.append(tuple(key_to_scan_codes(key) for key in keys)) File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/keyboard/init.py", line 311, in key_to_scan_codes left_scan_codes = key_to_scan_codes('left ' + normalized, False) File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/keyboard/init.py", line 317, in key_to_scan_codes t = tuple(_collections.OrderedDict((scan_code, True) for scan_code, modifier in _os_keyboard.map_name(normalized))) File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/keyboard/init.py", line 317, in t = tuple(_collections.OrderedDict((scan_code, True) for scan_code, modifier in _os_keyboard.map_name(normalized))) File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/keyboard/_nixkeyboard.py", line 148, in map_name build_tables() File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/keyboard/_nixkeyboard.py", line 64, in build_tables ensure_root() File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/keyboard/_nixcommon.py", line 174, in ensure_root raise ImportError('You must be root to use this library on linux.') ImportError: You must be root to use this library on linux.

[Program finished]

Link of this code https://www.thepythoncode.com/code/control-keyboard-python

question from:https://stackoverflow.com/questions/65932276/getting-error-on-using-keyboard-module-and-writing-command-in-pydroid3

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Have you managed to properly install keybord library for Pydroid3? I have an error at that stage.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...