我是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秒的时间。但没有得到任何解决方案。请提供解决方案。