Click on img with locateCenterOnScreen with pyAutoGui

12 views Asked by At

I'm trying to press on File with pyautogui.locateCenterOnScreen with an image (file.png), but I keep getting an unknown error from my point of view that I can't fix.

Code:

import pyautogui

cord = pyautogui.locateCenterOnScreen("file.png")
pyautogui.click(cord)

Error:

PS D:\pressFile> & "C:/Python Software/Python3_12_2/python.exe" d:/pressFile/pressFile.py
Traceback (most recent call last):
  File "d:\pressFile\pressFile.py", line 3, in <module>
    cord = pyautogui.locateCenterOnScreen("file.png")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: couldNotImportPyScreeze() takes 0 positional arguments but 1 was given
PS D:\pressFile> 

Version:

Python 3.12.2 
Requirement already satisfied: pyautogui in c:\python software\python3_12_2\lib\site-packages (0.9.41)
Requirement already satisfied: pymsgbox in c:\python software\python3_12_2\lib\site-packages (from pyautogui) (1.0.9)
Requirement already satisfied: PyTweening>=1.0.1 in c:\python software\python3_12_2\lib\site-packages (from pyautogui) (1.2.0)
Requirement already satisfied: Pillow in c:\python software\python3_12_2\lib\site-packages (from pyautogui) (10.2.0)
Requirement already satisfied: pyscreeze in c:\python software\python3_12_2\lib\site-packages (from pyautogui) (0.1.30)
Requirement already satisfied: pygetwindow in c:\python software\python3_12_2\lib\site-packages (from pyautogui) (0.0.9)
Requirement already satisfied: pyrect in c:\python software\python3_12_2\lib\site-packages (from pygetwindow->pyautogui) (0.2.0)

Screenshot:
Image with code + error

  1. Reinstall everything
  2. Watch different tutorials

What I expected it to do.. well work?

0

There are 0 answers