Skip to content Skip to sidebar Skip to footer

Python Pexpect Spawn Object Flush

I have a script where i am creating a spawn object using pexpect. The code looks like this: self.rshcmd='rsh 192.X.X.X' self.pipe1 = pexpect.spawn(command=self.rshcmd, logfile=sys.

Solution 1:

Do

child.send(cmd)
child.pexpect(cmd)
child.send('\n')

instead of

child.sendline(cmd)

This will solve your problem. (but when sending password do child.sendline(passwrd) )

Post a Comment for "Python Pexpect Spawn Object Flush"