PyAutoGUI Script no longer working - "windll.gdi32.getpixel failed"

Viewed 32

My script has been working fine for the past month or so (up til yesterday), but as of today when I run it, it returns the following:

Traceback (most recent call last):
  
File "C:\...\main.py", line 39, in <module>
    pxFish = pyautogui.pixelMatchesColor(int(fishLocX[i]), int(fishLocY[i]), (76, 76, 76), tolerance=50)
  
File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 589, in pixelMatchesColor
    pix = pixel(x, y)

File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 610, in pixel
    raise WindowsError("windll.gdi32.GetPixel failed : return {}".format(color))

OSError: windll.gdi32.GetPixel failed : return -1

I haven't made any changes to the code or to my system, so I have no idea why it'd just suddenly stop working. Help would be appreciated.

Also, somewhat bizarrely, my other functionally identical script still works (i.e. uses pixelMatchesColor, pyautogui click etc.).

Cheers.

0 Answers
Related