gpt4 book ai didi

python - 未使用预期超时,仅使用默认值 30

转载 作者:太空狗 更新时间:2023-10-29 22:08:31 25 4
gpt4 key购买 nike

我正在尝试执行一个冗长的操作,但带有超时参数的预期似乎并没有改变超时异常被触发之前的时间长度。这是我的代码:

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。

关于python - 未使用预期超时,仅使用默认值 30,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3338602/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com