Pexpect output !
Hi all.
Today i have download pexpect and started working on it. I want to access my cisco router and capture the output of "show version". So far i am successful in configuring the router. Pls check the script below import pexpect import sys child=pexpect.spawn("ssh cisco@192.168.15.8") child.expect("Password:") child.sendline("cisco") child.expect(".*>") child.sendline("en") child.expect("Password:") child.sendline("cisco") child.expect(".*#") child.sendline("conf ter") child.expect("R1.*#") child.sendline("int loo 200") child.logfile = sys.stdout Now on my router, the configuration was done perfectly. Which means my pexpect script is working fine. But i am not able to get the following 1) I want to capture the output of 'show version' (or any other command) to a file. When i googled, the last bolded line seemed to be the solution but its not working. When i run the script, it simply runs and then i get the prompt again, no output of show version :-( Pls someone guide me |
I've never used pexpect, but I would guess that you need to set the logfile before running the commands.
|
All times are GMT -5. The time now is 05:20 PM. |