[Tutor] Obtaining result from a sendline

Dave Wilder D.Wilder at F5.com
Wed Oct 31 02:47:06 CET 2012


Okay, file this under RTFM, but even after research, I cannot figure out the answer to this simple question.



When I do an ssh in python (version 2.7.3) to a device, I am trying to capture the output of the command.

However, all I get back is a numerical value.  I am looking to get the actual output from the "ls /var/tmp"

command below.  This is probably readily available info, but I am just not searching on the python sites correctly.



e.g.

(Pdb) ssh = sshClient.pxssh()

(Pdb) ssh.login(server=ip_addr, username=user, password=pswd)

True

(Pdb) str = ssh.sendline('ls /var/tmp')

(Pdb) str

12

(Pdb)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121031/73922122/attachment.html>


More information about the Tutor mailing list