718119 ランダム
 HOME | DIARY | PROFILE 【フォローする】 【ログイン】

【毎日開催】
15記事にいいね!で1ポイント
10秒滞在
いいね! --/--
おめでとうございます!
ミッションを達成しました。
※「ポイントを獲得する」ボタンを押すと広告が表示されます。
x

PR

Free Space

Debian GNU/Linux、Windows etc に関して、
雑文を掲載しています。 
個人的な備忘録ですので、皆様にあてはまるかどうかは、
全くわかりません。
参考にされる場合も、結果については、自己責任
ということで、よろしくお願いいたします。










Keyword Search

▼キーワード検索

Calendar

Archives

2024.05
2024.04
2024.03
2024.02
2024.01
2023.12
2023.11
2023.10
2023.09
2023.08

Category

Recent Posts

Rakuten Card

2022.01.12
XML
カテゴリ:Debian
Debian11にしてPyAutoGUIのスクリプトを走らせてみると、画像出待ち処理でエラーになる。
$ python3 --version
Python 3.9.2

$ pip3 list | grep 'GUI'
PyAutoGUI         0.9.53

​変更した箇所
#import pyscreeze
#from pyscreeze import ImageNotFoundException
#pyscreeze.USE IMAGE NOT FOUND EXCEPTION = True
pyautogui.useImageNotFoundException()
あと、各所のImageNotFoundExceptionをpyautogui.ImageNotFoundExceptionに書き換え
pyscreeze というモジュールのImageNotFoundExceptionは使うな、ということらしい。で、ImageNotFoundException()という関数を使えと。これを使うと locateで画像の座標を探して見つからなかったらpyautogui.ImageNotFoundExceptionが立つらしい。

参考例
https://www.fixes.pub/program/872186.html
これの一番下のが最新の書き方らしい。

"""
import pyautogui
# force use of ImageNotFoundException
pyautogui.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__.py

class 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.
    """











お気に入りの記事を「いいね!」で応援しよう

Last updated  2022.01.12 11:36:46
[Debian] カテゴリの最新記事



© Rakuten Group, Inc.