Why my program (using pexpect to switch user) doesn't work well?

2008-01-10 Thread BlackjadeLin
I'm new to python I want to write a simple script to switch user,for example,from user_A to user_B. This my codes: #!/usr/bin/python import pexpect import os passwd="user_B" child = pexpect.spawn('su user_B') child.expect('Password:') child.sendline(passwd) child.expect('$') child.close() Maybe i

Re: Why my program (using pexpect to switch user) doesn't work well?

2008-01-12 Thread BlackjadeLin
On Jan 11, 1:49 am, Noah <[EMAIL PROTECTED]> wrote: > On Jan 10, 12:59 am, BlackjadeLin <[EMAIL PROTECTED]> wrote: > > > > > I'm new to python > > I want to write a simple script to switch user,for example,from user_A > > to user_B. > > Thi