0

我是 pexpect 模块的新手。我在与远程服务器连接期间收到此错误。我正在使用以下代码:

main_server = pexpect.spawn(cmd)
        i = main_server.expect ([pexpect.TIMEOUT,
                   pexpect.EOF,
                   'Are you sure you want to continue connecting (yes/no)?',
                   'Host key verification failed.',
                   'Connection refused',
                   'Connection timed out',
                   'Connection closed by remote host',
                   'password:'])

        if i == 0:
              main_server.sendline("user time out")
              connect_remote_servers_tunnel(local_db_cursor,server_ip,\
              user_name,password,tunnel_user_name,\
              tunnel_password,system_ip,circle_code,circle_name,port_no,user,passwd)
        if i == 2:
              main_server.sendline ("yes")
              connect_remote_servers_tunnel(local_db_cursor,server_ip,\
              user_name,password,tunnel_user_name,\
              tunnel_password,system_ip,circle_code,circle_name,port_no,user,passwd)
        if i == 7:
              main_server.sendline (password)

        main_server.expect(pexpect.EOF)
        tables=main_server.before
        main_server.sendline('logout')
        main_server.read()

我搜索了这个错误,但没有得到任何解决方案。我手动提供超时来更改模块的默认超时时间,即 30 秒。但没有得到任何解决方案。请提供解决方案。

4

0 回答 0