我正在尝试执行一个冗长的操作,但是带有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)
异常显示超时=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
如果仅在.spawn调用中指定超时,则无法重写或在.expect调用中使用timeout=300,则该方法似乎有效。
相关问题 更多 >
编程相关推荐