Tôi đang cố gắng thực hiện một thao tác dài nhưng mong đợi với đối số hết thời gian chờ dường như không thay đổi khoảng thời gian trước khi hết thời gian chờ. Đây là mã của tôi:thời gian hết hạn chờ đợi không được sử dụng, chỉ mặc định là 30 đang được sử dụng
child = pexpect.spawn('scp file [email protected]:/temp', timeout=300)
whichMatched = child.expect(['(?i)Password','Are you sure you want to continue connecting (yes/no)?'], timeout=300)
Ngoại lệ cho biết timeout = 30, mặc định.
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