Chinaunix首页 | 论坛 | 博客
  • 博客访问: 471470
  • 博文数量: 135
  • 博客积分: 1860
  • 博客等级: 上尉
  • 技术积分: 1441
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-05 20:39
文章分类
文章存档

2012年(2)

2011年(130)

2009年(2)

2008年(1)

我的朋友

分类: 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

 

'''

阅读(1309) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~