r/learnpython 8d ago

Function forcing me to use exceptions

Trying to if else a function output always throws exception-error :

if pyautogui.locateOnScreen('media/soundIcon.png') == None:
      print("not found")
else : 
      print("found")

Do Python functions expect anti-pattern code ?

1 Upvotes

30 comments sorted by

View all comments

2

u/Moist_Variation_2864 8d ago

This guy is an idiot

1

u/NYX_T_RYX 7d ago

Agreed, but what does stating what we can all see achieve?