Here\'s the code that I\'m trying to run:
import pyautogui r=pyautogui.locateOnScreen(\'C:\\Users\\David\\Desktop\\index.png\',grayscale=False) print r
I was encountering the same problem, what I did is
import pyautogui r= None while r is None: r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False) print r
I think its just because that it takes time to locate image. If you found a better solution share with me :)