Jul-07-2021, 03:31 AM
(This post was last modified: Jul-07-2021, 11:31 AM by Larz60+.
Edit Reason: fixed bbcode tags on error
)
Using either pip3 install mouse and sudo pip3 install mouse generate the following error when importing the library into a script (Autokey).
# [win + z] import mouse, time i = 1 while i < 2: mouse.move(265, 116, absolute=True, duration=0.2) time.sleep(0.2) keyboard.wait_for_keypress("<escape>", timeOut=1.0) mouse.click("right") ### time.sleep(0.2) keyboard.send_keys("<alt>+<shift>+s") i = 1What am I doing wrong?
Error:Traceback (most recent call last):
File "/home/ineuw/.local/lib/python3.8/site-packages/autokey/service.py", line 530, in _execute
exec(compiled_code, scope)
File "/home/ineuw/.config/autokey/data/macros/win-z.py", line 10, in <module>
mouse.click("right")
File "/home/ineuw/.local/lib/python3.8/site-packages/mouse/__init__.py", line 93, in click
_os_mouse.press(button)
File "/home/ineuw/.local/lib/python3.8/site-packages/mouse/_nixmouse.py", line 105, in press
build_device()
File "/home/ineuw/.local/lib/python3.8/site-packages/mouse/_nixmouse.py", line 72, in build_device
ensure_root()
File "/home/ineuw/.local/lib/python3.8/site-packages/mouse/_nixcommon.py", line 165, 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.
Linux Mint Cinnamon 22 - Python 3.12.3 - Autokey-gtk 0.96.0 as of 2024-01-13.