于 2012-4-24 18:13, Joel Goldstick 写道:
On Tue, Apr 24, 2012 at 4:11 AM, 叶佑群<[email protected]>  wrote:
Hi, all

    I have two block code as:

Block 1:
            #......
            pobj = subprocess.Popen (["passwd", user],
stdout=subprocess.PIPE, stdin = subprocess.PIPE)
            password = password + "\n"
            pobj.stdin.write (password)
            pobj.stdin.write (password)
            #......
Block 2:
            #......
            pobj = subprocess.Popen (["pdbedit", "-a", user],
stdout=subprocess.PIPE, stdin =subprocess.PIPE)
            password = password + "\n"
            pobj.stdin.write (password)
            pobj.stdin.write (password)
            #......

        The only difference is command to run, but code of Block 1 runs OK,
and Block 2 can't write the password to "pdbedit". Is there any thing wrong
with the code above or if something else cause Block 2 failed? Any
suggestion ?

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
This isn't really a 'learning python' question.  But I googled pdedit
and found this:
Sorry for that, this is my first time to ask help to the community.

        -a     This option is used to add a user into the database.  This  com-
               mand needs a user name specified with the -u switch. When adding
               a new user, pdbedit will also ask for the password to be used.

               Example: pdbedit -a -u sorce
               new password:
               retype new password
Thanks for your patience and kindness!
So it looks like if you use -a you also need -u




_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to