1

Pywinauto を使用してアプリケーションのインストールを自動化しようとしています。インストール中に最後のウィンドウにいくつかの警告またはエラー メッセージが表示され、後でシステムが再起動し始めます。私の目的は、によって可能な警告メッセージをキャプチャすることです

app.top_window_()._ctrl_identifiers()
np.Notepad.Edit.TypeKeys(a,with_spaces=True, with_tabs=True, with_newlines=True)

これは、画面のすべてのメッセージを含むリストを返しています。2行目は、リストオブジェクトをメモ帳に印刷しようとしているところですが、いくつかの例外がスローされています

Traceback (most recent call last):
  File "<pyshell#37>", line 1, in <module>
    np.Notepad.Edit.TypeKeys(a,with_spaces=True, with_tabs=True, with_newlines=True)
  File "C:\Python26\pywinauto\controls\HwndWrapper.py", line 950, in TypeKeys
    turn_off_numlock)
  File "C:\Python26\pywinauto\SendKeysCtypes.py", line 629, in SendKeys
    keys = parse_keys(keys, with_spaces, with_tabs, with_newlines)
  File "C:\Python26\pywinauto\SendKeysCtypes.py", line 538, in parse_keys
    c = string[index]
KeyError: 0

誰かがこれを行う方法を教えてもらえますか、またはこれを例で処理できる他の方法があるかどうか教えてください。

4

1 に答える 1

0

再フォーマット::

コード

app.top_window_()._ctrl_identifiers()  # did you mean print_control_identifiers() ?
np.Notepad.Edit.TypeKeys(a,with_spaces=True, with_tabs=True, with_newlines=True)

トレースバック

Traceback (most recent call last): 
File "", line 1, in 
    np.Notepad.Edit.TypeKeys(a,with_spaces=True, with_tabs=True, with_newlines=True) 
File "C:\Python26\pywinauto\controls\HwndWrapper.py", line 950, in TypeKeys 
    turn_off_numlock) 
File "C:\Python26\pywinauto\SendKeysCtypes.py", line 629, in SendKeys 
    keys = parse_keys(keys, with_spaces, with_tabs, with_newlines) 
File "C:\Python26\pywinauto\SendKeysCtypes.py", line 538, in parse_keys 
    c = string[index] KeyError: 0

2行目に何が含まれているかを説明していませんaが、文字列ではなく辞書を渡しているようです。SendKeys()文字列を期待します。

それが役立つことを願っています

于 2010-06-14T09:38:22.390 に答える