PyAutoGUI 画像が出るまで待つ処理
Debian11にしてPyAutoGUIのスクリプトを走らせてみると、画像出待ち処理でエラーになる。$ python3 --versionPython 3.9.2$ pip3 list | grep 'GUI'PyAutoGUI 0.9.53変更した箇所#import pyscreeze#from pyscreeze import ImageNotFoundException#pyscreeze.USE IMAGE NOT FOUND EXCEPTION = Truepyautogui.useImageNotFoundException()あと、各所のImageNotFoundExceptionをpyautogui.ImageNotFoundExceptionに書き換えpyscreeze というモジュールのImageNotFoundExceptionは使うな、ということらしい。で、ImageNotFoundException()という関数を使えと。これを使うと locateで画像の座標を探して見つからなかったらpyautogui.ImageNotFoundExceptionが立つらしい。参考例https://www.fixes.pub/program/872186.htmlこれの一番下のが最新の書き方らしい。"""import pyautogui# force use of ImageNotFoundExceptionpyautogui.useImageNotFoundException()try: location= pyautogui.locateOnScreen('foo.png') print('image found')except pyautogui.ImageNotFoundException: print('ImageNotFoundException: image not found')"""https://github.com/asweigart/pyautogui/blob/master/pyautogui/__init__.pyclass ImageNotFoundException(PyAutoGUIException): """ This exception is the PyAutoGUI version of PyScreeze's `ImageNotFoundException`, which is raised when a locate*() function call is unable to find an image. Ideally, `pyscreeze.ImageNotFoundException` should never be raised by PyAutoGUI. """