read_nonblocking error in pxssh

kayvansylvan at gmail.com kayvansylvan at gmail.com
Fri Feb 1 19:49:08 CET 2008


On Jan 16, 9:24 am, jrpfinch <jrpfi... at gmail.com> wrote:
> I'm attempting to use thepxsshto execute commands on a remote
> machine and do stuff with the output.  Both machines are running SSH
> Version Sun_SSH_1.0, protocol versions 1.5/2.0 and Intel Solaris 9.
>
> I am hitting a problem with read_nonblocking in the pexpect module as
> follows:
>
> >>> importpxssh
> >>> s=pxssh.pxssh()
> >>> s.login("myhost","root","mypass")
>
> Trying command: ssh -q -l root gerard
> Expect returned i=2
> Expect returned i=1
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "pxssh.py", line 244, in login
>     if not self.synch_original_prompt():
>   File "pxssh.py", line 134, in synch_original_prompt
>     self.read_nonblocking(size=10000,timeout=10) # GAS: Clear out the
> cache before getting the prompt
>   File "/opt/python2.5.1/lib/python2.5/site-packages/pexpect.py", line
> 824, in read_nonblocking
>     raise TIMEOUT ('Timeout exceeded in read_nonblocking().')
> pexpect.TIMEOUT: Timeout exceeded in read_nonblocking().
>
> Running the ssh command from the shell yields:
>
> bash-2.05# ssh -q -l root myhost
> root at myhost's password:
> Last login: Wed Jan 16 17:10:32 2008 from x.x.x.x
> Sun Microsystems Inc.   SunOS 5.9       Generic January 2003
> Sun Microsystems Inc.   SunOS 5.9       Generic January 2003
> root at myhost:/ #
>
> I would be grateful if anyone could make a suggestion as to where I go
> next?  Is read_nonblocking(), the correct method to be using here?
> Are there any options inpxsshI need to explore (I've tried ssh -t,
> but this means the password entry fails with raise ExceptionPxssh
> ('password refused')).
>
> Many thanks
>
> Jon

Did you get anywhere with this? I have the exact same problem on a
CentOS Linux system.

---Kayvan



More information about the Python-list mailing list