Can any one please tell me, what is the prompt we have to give for expecting a blank space for a python script.I need to execute a command which will execute only after it sees the expect prompt.On doing manually i got that the prompt is a blank space,and has to expect the same prompt via script also.
import pexpect import pxssh import time import os,re,sys
def ssh(ipaddr,password): try:
ss = pexpect.spawn(ipaddr)
print ipaddr
ss.logfile = open("/tmp/mynewlog", "a")
print "SSH connecting"
print
except:
print "connection refused"
print
#sys.exit()
try:
print password
ss.expect (':')
ss.sendline (password +"\n")
print "connected"
time.sleep(30)
ss.expect (">")
print "connection established"
print
except:
print "Permission denied, please try again."
print
sys.exit()
try:
ss.sendline ('taskkill /F /IM iperf.exe\n')
time.sleep(30)
ss.expect ('>')
ss.sendline ('cd /D D:\iperf-2.0.5-2-win32\n')
ss.expect ('>')
ss.sendline ('iperf -s\n')#########This command i need to execute and i'm expecting a blank space as prompt
ss.sendline (pexpect.EOF)
print "END"
ssh()
except:
print "Failed to execute the command"
print
sys.exit()