popen and password entry

Ganesan Rajagopal rganesan at myrealbox.com
Thu Jun 15 08:43:26 EDT 2006


>>>>> sinan nalkaya <orome.the.valar at gmail.com> writes:

> child.expect(['Password:','Password: ',pexpect.EOF,pexpect.TIMEOUT])
>                 if i == 0:      child.sendline(passwd)
>                 elif i == 1:    print 1
>                 elif i == 2:    print 2
>                 elif i == 3:    print 3

You don't need the second pattern, the first pattern will catch the second
case also. You also need to break when i == 2 or i == 3. 

Ganesan

-- 
Ganesan Rajagopal




More information about the Python-list mailing list