長い操作を実行しようとしていますが、timeout引数を指定したpexpectは、タイムアウト例外が発生するまでの時間の長さを変更しないようです。これが私のコードです:
child = pexpect.spawn('scp file user@:/temp', timeout=300)
whichMatched = child.expect(['(?i)Password','Are you sure you want to continue connecting (yes/no)?'], timeout=300)
例外は、デフォルトであるtimeout=30を示しています。
after: <class 'pexpect.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 6222
child_fd: 4
closed: False
timeout: 30
delimiter: <class 'pexpect.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1