asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.45k stars 1.26k forks source link

pyautogui should propagate the ImageNotFoundException message upward #850

Open SteveOnorato opened 7 months ago

SteveOnorato commented 7 months ago

https://github.com/asweigart/pyautogui/blob/b4255d0be42c377154c7d92337d7f8515fc63234/pyautogui/__init__.py#L174 discards the exception message from pyscreeze. I find the "(highest confidence =x)" part of the message super-useful, so perhaps you'd be willing to propagate it through with something like: raise ImageNotFoundException(str(ex)) # Raise PyAutoGUI's ImageNotFoundException.

(The exceptions I care about are initially thrown here: https://github.com/asweigart/pyscreeze/blob/eeca245a135cf171c163b3691300138518efa64e/pyscreeze/__init__.py#L256C70-L256C91 )

gtmsingh commented 1 month ago

I have created this PR for resolving this issue: https://github.com/asweigart/pyautogui/pull/887