2011-05-16 45 views
5

我想在使用pxssh moudule的python腳本的遠程計算機上執行ssh。在使用pxssh(ssh模塊for python)時讀取非阻塞錯誤

這裏是我使用相同的代碼行:

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

但是,這給了我下面的超時錯誤。

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(). 
+2

您是否嘗試了http://mail.python.org/pipermail/python-list/2008-February/1178169.html中提供的解決方法(涉及輕微更改pxssh代碼?) – a3nm 2011-05-16 04:08:22

回答

3

我已經改變了python庫,而是使用更穩定的paramiko,並沒有給出上述錯誤。