使用 pxssh 时读取非阻塞错误(python 的 ssh 模块) [英] Read Non Blocking error while using pxssh (ssh module for python)

查看:28
本文介绍了使用 pxssh 时读取非阻塞错误(python 的 ssh 模块)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用使用 pxssh 模块的 python 脚本在远程机器上执行 ssh.

I am trying to do ssh on a remote machine using a python script using pxssh moudule.

这是我用于相同的代码行:

Here are the lines of code that I use for the same :

    s = pxssh.pxssh()
    s.login (hostip,'root',auto_prompt_reset=False)

但这给了我以下超时错误.

But this gives me the following TIMEOUT error.

  Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/pxssh.py", line 243, in login
    if not self.synch_original_prompt():
  File "/usr/local/lib/python2.6/dist-packages/pxssh.py", line 134, in synch_original_prompt
    self.read_nonblocking(size=10000,timeout=1) # GAS: Clear out the cache before getting the prompt
  File "/usr/local/lib/python2.6/dist-packages/pexpect.py", line 824, in read_nonblocking
    raise TIMEOUT ('Timeout exceeded in read_nonblocking().')
pexpect.TIME

OUT: Timeout exceeded in read_nonblocking().

推荐答案

我已经更改了 python 库,而是使用了 paramiko,它更加稳定并且不会出现上述错误.

I have changed the python library and instead using paramiko which is much more stable and doesn't give the above error.

这篇关于使用 pxssh 时读取非阻塞错误(python 的 ssh 模块)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆