On Mon, 8 Jun 2009 21:48:50 +0530
Senthil Kumaran <orsent...@gmail.com> wrote:

> I have been trying to use pexpect and I am failing with
> pexpect.TIMEOUT for all my attempts. In order to troubleshoot, I
> decided to go with simplest possible one.
> 
> Here is my ssh to localhost:
> 
> [21:29:14 senthil]$ssh localhost -l senthil
> sent...@localhost's password:
> sent...@ubuntu:~$
> 
> And here is my pexpect script:
> 
> http://paste.pocoo.org/show/121788/

I am not very familiar with pexpect, but from what I remember
of Expect, there are a couple of issues here:
o You should be using p.expect() instead of time.sleep()
o After issuing a 'fortune' command you should be expecting a
  shell prompt.
o You should explicitly close the connection by logging out

Please see http://paste.pocoo.org/show/121800/ where I have used
'ls' instead of 'fortune' as I did not have the latter installed.
The pattern matches anything, i.e., whatever be the shell prompt,
and child.expect also matches EOF.

Regards,
Gora
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to