File "C:\Users\rkey\AppData\Local\Programs\Python\Python38\lib\site-packages\pyautogui\__init__.py", line 174, in wrapper
raise ImageNotFoundException # Raise PyAutoGUI's ImageNotFoundException.
pyautogui.ImageNotFoundException
导致无法判断结果是None.
比如这样会出问题:
img_path= r".\\image_for_identify\\free_finished.jpg"
while location is None and time.time() - start_time < timeout:
location = pyautogui.locateOnScreen(imageFile,grayscale=True, confidence=0.8)
if location is None:
time.sleep(0.1)