全部博文(135)
分类: Python/Ruby
2011-08-11 16:52:59
不能login
2011年1月16日
15:37
Q: 现象:
login调用出现下面的错误
TIMEOUT: Timeout exceeded in read_nonblocking().
解决办法:
Timeout exceeded in read_nonblocking when using pxssh in pexpect (zz)2008-08-28 13:08Just add:
time.sleep(0.5)
self.sendline()
right before the first read_nonblocking() call within synch_original_prompt in pxssh.py
---------------------------------------------------------------------------------------------------------------
'''
I don't know if anyone ever got back to you with a fix, but for me the
fix was really simple.
I just added a self.sendline() and a time.sleep(0.5) right before the
first read_nonblocking() call within synch_original_prompt
The reason is that you have to have stuff in the buffer in order to
read it. In the case that they programmed for originally,
**something** exists in their prompt (probably a space) after the $ or
#. In my case (and probably yours) the last thing on the prompt
**is** the $ or #, causing the buffer to be non-existent when the
first read_nonblocking() happens. So all we do is put something there
before the read.
Why not just get rid of the first read since it is just "clearing the
buffer" anyway? Because then, although it would now work for us, it
would no longer work for the original programmers.
- Jinno
'''