'I want that is always search for the Image, error is line 13, in <module> cords = pyautogui.locateCenterOnScreen('Images/Image.png', confidence=.4)

i dont know what i need to do after 3 sec comes the error message what do I have to change that script is still looking for the image until it has found the image

import pyautogui
import time

time.sleep(3)

pyautogui.hold("x")

while True:
    cords = pyautogui.locateCenterOnScreen('Images/Image.png', confidence=.4)
    pyautogui.middleClick(cords)
    time.sleep(0.7)
enter code here
    buy = 888, 458
    pyautogui.click


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source