'opencv bot Recursion Error using pyautogui , python-imagesearch, cv2
Im writing a bot using cv2 , pyautogui,and imagesearch libaries. in this function im searching for an image then I'm going to run another function when found if not search again.
I get an error if the image is not found and the function runs for a while. can anyone help me without setting the recursion higher? RecursionError: maximum recursion depth exceeded while calling a Python object. if I'm unclear tell me don't just -1 me please and I will re-explain
(pip install python-imagesearch. it's a wrapper around pyautogui and opencv2, to allow you to easily add cross-platform image searching capabilities to your project. https://pypi.org/project/python-imagesearch/ or https://github.com/drov0/python-imagesearch)
from python_imagesearch.imagesearch import *
def function_one():
pos = imagesearch("Bot/image1.png")
if pos[0] != -1:
print("found image one")
function_two()
print('running action two')
function_three()
else:
print("didn't find image one, starting again")
function_one()
Solution 1:[1]
this is wanted to avoid but it worked good
import sys
sys.setrecursionlimit(1500)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | signmeupnow |