简体   繁体   中英

PyAutoGUI locate on screen function giving error on linux

When running the pyautogui.locateOnScreen() function it gives me the following error:

scrot: invalid option -- 'z'

Does anyone know why this might be happening? I have scrot 0.8 installed and just running scrot a.png in the terminal works just fine. Running scrot -z gives the same scrot: invalid option -- 'z' error message. Any help is appreciated.

You can safely ignore it, or if it bothers you, fork or submit a PR to pyscreeze .

pyautogui depends on the pyscreeze package to take cross-platform screenshots. On Linux, pyscreeze uses a command-line utility called scrot .

When pyscreeze shells out to scrot, it passes -z . This specifies Prevent beeping in some versions of scrot, but isn't always available. For instance, it's missing in Fedora's scrot-0.8-21.fc31.x86_64 .

But invalid option -- 'z' isn't a fatal error. You can verify this by running $ scrot -z and seeing that a new timestamped screenshot appears in your working directory, despite the message. Or from Python, call subprocess.call(['scrot', '-z']) , and see that the return code is 0 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM