问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
coding=utf-8
import pyautogui
file_name = "d:\vmc\projectOptions\新选项.png"
imageObject = pyautogui.locateCenterOnScreen(file_name, confidence=0.3)
print(imageObject)
运行结果及报错内容
imageObject = pyautogui.locateCenterOnScreen(file_name, confidence=0.3)
File "D:\software\Python37\lib\site-packages\pyautogui_init.py", line 175, in wrapper
return wrappedFunction(*args, **kwargs)
File "D:\software\Python37\lib\site-packages\pyautogui_init.py", line 207, in locateCenterOnScreen
return pyscreeze.locateCenterOnScreen(*args, **kwargs)
File "D:\software\Python37\lib\site-packages\pyscreeze_init.py", line 413, in locateCenterOnScreen
coords = locateOnScreen(image, **kwargs)
File "D:\software\Python37\lib\site-packages\pyscreeze_init.py", line 373, in locateOnScreen
retVal = locate(image, screenshotIm, **kwargs)
File "D:\software\Python37\lib\site-packages\pyscreeze_init.py", line 353, in locate
points = tuple(locateAll(needleImage, haystackImage, **kwargs))
File "D:\software\Python37\lib\site-packages\pyscreeze_init.py", line 207, in _locateAll_opencv
needleImage = load_cv2(needleImage, grayscale)
File "D:\software\Python37\lib\site-packages\pyscreeze_init.py", line 172, in _load_cv2
"unsupported or invalid format" % img)
OSError: Failed to read d:\vmc\projectOptions\新选项.png because file is missing, has improper permissions, or is an unsupported or invalid format