Skip to content
Advertisement

Can’t locate image on python

I try to locate an image on my screen. But it always shows this –

Traceback (most recent call last):
  File "C:/Users/MerazulIslam/Desktop/ZOOM_BOT/bot.py", line 20, in <module>
    find_btn = pyautogui.locateOnScreen(r'C:UsersMerazulIslamDesktopZOOM_BOTCapture.PNG', confidene=0.5)
  File "C:UsersMerazulIslamAppDataRoamingPythonPython38site-packagespyautogui__init__.py", line 175, in wrapper
    return wrappedFunction(*args, **kwargs)
  File "C:UsersMerazulIslamAppDataRoamingPythonPython38site-packagespyautogui__init__.py", line 213, in locateOnScreen
    return pyscreeze.locateOnScreen(*args, **kwargs)
  File "C:UsersMerazulIslamAppDataRoamingPythonPython38site-packagespyscreeze__init__.py", line 359, in locateOnScreen
    screenshotIm = screenshot(region=None) # the locateAll() function must handle cropping to return accurate coordinates, so don't pass a region here.
  File "C:UsersMerazulIslamAppDataRoamingPythonPython38site-packagespyscreeze__init__.py", line 134, in wrapper
    raise PyScreezeException('The Pillow package is required to use this function.')
pyscreeze.PyScreezeException: The Pillow package is required to use this function.

my code-

import pyautogui

find_btn = pyautogui.locateOnScreen(r'C:UsersMerazulIslamDesktopbotCapture.PNG')
print(find_btn)

Please help!

Advertisement

Answer

You can just try to reinstall pyautogui with all dependencies to make sure nothing missing:

pip install --upgrade --force-reinstall pyautogui
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement