Reading error without blocking when using pxssh (ssh module for python)

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 them:

    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().
+5
source share
2 answers

I changed the python library and instead used paramiko, which is much more stable and does not give the above error.

+3
source

I had the same problem. This post ( http://bytes.com/topic/python/answers/760027-read_nonblocking-error-pxssh ) had a solution.

" self.sendline() time.sleep(0.5) read_nonblocking() synch_original_prompt() "

.

+2

All Articles