asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.22k stars 1.24k forks source link

[Remote Mac Server] pyautogui.locateCenterOnScreen() sometimes fail. Guess error in "subprocess.call(['screencapture', '-x', tmpFilename])" #766

Open rrrrrrrero opened 1 year ago

rrrrrrrero commented 1 year ago

Help!!!!! Device Info: Monterey 12.6.1

pyautogui.locateCenterOnScreen() worked mostly fine, but sometimes went wrong. The error is listed as follow:

FileNotFoundError: [Errno 2] No such file or directory: 'screenshot2023-0315_05-46-45-566382.png'

I guess the problem may occur in this func but have no idea how to deal with it.
image