#๐Ÿ”’ Pyautogui Image help

14 messages ยท Page 1 of 1 (latest)

dusky basin
#

How do I make it search for different images. Lets say it searches for one image, it doesnt find it, it switches to the next image, doesnt find it, switches again, and if it doesnt find it, then it tries the except. And if it finds image 2 is true, i can set up a temp variable value 2, if it finds image 1 is true, it sets up a temp variable thats value is 1, and so on so forth

sweet mulchBOT
#

@dusky basin

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

dusky basin
#

Im using this, ignore the yoo and whatever, its just a temporary thing

#

but I cant make it locate another image if I try elif

#

I'm not sure why it wont work

#

i thought if, elif, elif again, and then it goes to the except, but it doesnt, it just immediately goes to the except

dusky basin
#

made it this far but stuck again, it doesnt print anything or show anything

patent stream
#
imagelist = ['Rare.png', 'Edge.png']
error = None
found = False
for image in imagelist:
  try:
    # do your search
    found = True
  except pyautogui.ImageNotFoundException as e:
    error = e  # store the exception and continue

if not found and error:
  # raise the last exception
  # You may raise your own exception as well
  raise error
#

This is my solution

patent stream
#

The exception will be raised every time the image is not found. That's my thought

sweet mulchBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.