4

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 samescrot: invalid option -- 'z' error message. Any help is appreciated.

Max
  • 43
  • 3
  • when I run `scrot --help` then it shows `-z, --silent Prevent beeping`. `scrot -v` shows it is version 0.8. Linux Mint 19.2 (based on Ubuntu 18.04) Maybe there are two different `scrot` – furas Jan 05 '20 at 21:26
  • I also see this error on Fedora 31 after installing `scrot-0.8-21.fc31.x86_64`, which doesn't provide a `-z` option. There's a [GitHub issue](https://github.com/asweigart/pyautogui/issues/372). – effel Apr 11 '20 at 17:54

1 Answers1

1

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.

effel
  • 1,421
  • 1
  • 9
  • 17