I started using the Pexpect
library and for some reason I am having problems getting expressions to get matched.
For example in the following code
import pexpect
child=pexpect.spawn('su')
i=child.expect_exact('Password:')
print "value of i is %d" %i
if i==1:
p=input("Please enter root password : ")
child.sendline(p)
child.sendline('echo piggy')
problem i never equals 1