0

I've been struggling with this issue already for a few days but I can't manage to fix it. So I have the following code

import pyautogui
from pyautogui import locateOnScreen, press, click
from time import sleep
import pydirectinput
import keyboard

button_location = locateOnScreen("button.png", confidence="0.7")

And I get the following error:

TypeError: _locateAll_python() got an unexpected keyword argument 'confidence'

I've literally installed and uninstalled a lot of python versions (2.7, 3.6, 3.7, 3.8, 3,9) but I always get the same error. I use the following commands to install the packages:

pip install pyautogui
pip install opencv-python

And just in case, it's a Windows machine with an i5.

Miki
  • 40,887
  • 13
  • 123
  • 202
gxp2
  • 149
  • 2
  • 11
  • This might be useful: https://stackoverflow.com/questions/57832850/documentation-says-to-use-a-confidence-parameter-but-it-throws-an-error – Ashok Nov 15 '20 at 17:21
  • I've already seen that, and I have a version of opencv-python superior to 3, and have installed it along with pyautogui. So this doesn't answer my problem, thanks for the insight though! – gxp2 Nov 15 '20 at 17:23

1 Answers1

0

After importing cv2 (open cv), I realised that the error was related to numpy. I tried updating it with -U but it still didn't work, what worked finally was the following:

pip install numpy==1.15.2

gxp2
  • 149
  • 2
  • 11