ElectronTrafficCop
ElectronTrafficCop

Reputation: 21

PyAutoGUI error (python, visual studio, MacOS)

I have a simple python script in visual studio on MacOS. Everytime I try to run it I get the following error please help!

enter image description here

Kyles-MacBook-Pro-12:Python brogan$ cd /Users/brogan/Desktop/Python ; /usr/bin/env /usr/local/bin/python3 /Users/brogan/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 56397 -- /Users/brogan/Desktop/Python/AutoGUI.py Traceback (most recent call last): File "/Users/brogan/Desktop/Python/AutoGUI.py", line 3, in res = pyautogui.locateOnScreen("Apple_Logo.png") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyautogui/init.py", line 228, in _couldNotImportPyScreeze raise PyAutoGUIException( pyautogui.PyAutoGUIException: PyAutoGUI was unable to import pyscreeze. (This is likely because you're running a version of Python that Pillow (which pyscreeze depends on) doesn't support currently.) Please install this module to enable the function you tried to call.

Ive tried installing PyScreeze

Kyles-MacBook-Pro-12:Python brogan$ pip3 install PyScreeze Requirement already satisfied: PyScreeze in /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages (0.1.30)

This is the response... I believe I already have it.

Upvotes: 0

Views: 1032

Answers (2)

ElectronTrafficCop
ElectronTrafficCop

Reputation: 21

The solution for me was to install pillow.

pip3 install pillow

Upvotes: 1

1bura
1bura

Reputation: 35

try installing pyscreeze

pip install pyscreeze

and then use the following code

import pyscreeze

x, y = pyscreeze.locateOnScreen("Apple_Logo.png", confidence=0.5)

Upvotes: 0

Related Questions