Home > OS >  Why my code don't work when I pass it to .exe?
Why my code don't work when I pass it to .exe?

Time:11-04

I made a program that detects an image on the screen, I use for it the pyautogui library, when I run my program it works perfectly well, but when I pass it in executable, it does not work anymore and I have the error message below.

I am under windows 10. I have python 3.10 and pyinstaller 5.0

The error message :

Traceback (most recent call last):
  File "interface.py", line 21, in <module>
    ScreenLocation = pa.locateOnScreen('module\images\location.PNG', confidence=0.7)
  File "pyautogui\__init__.py", line 175, in wrapper
  File "pyautogui\__init__.py", line 213, in locateOnScreen
  File "pyscreeze\__init__.py", line 373, in locateOnScreen
  File "pyscreeze\__init__.py", line 353, in locate
  File "pyscreeze\__init__.py", line 253, in _locateAll_python
NotImplementedError: The confidence keyword argument is only available if OpenCV is installed.

enter image description here

I hope I've been clear enough, don't hesitate to ask me questions if there is any information missing to solve my problem, thank you for taking time for me, I hope we will find a solution.

CodePudding user response:

Pip install OpenCV and import OpenCV in your script.

  • Related