Hi, all

   I have code as:

/ pobj = subprocess.Popen (["smbpasswd", user], stdin =subprocess.PIPE)
            password += "\n"
            pobj.stdin.write (password)
            pobj.stdin.write (password)/

the command smbpasswd will change the samba user's password, In shell this will run as below:

/            [root@localhost ~]# smbpasswd mytest1
            New SMB password:
            Retype new SMB password:
            [root@localhost ~]# /

but in python code, it always prompt to wait input the password, it is seems that pobj.stdin.write () doesn't work. It is anything wrong with my code? I have another block code that runs as expected:

/ pobj = subprocess.Popen (["passwd", user], stdin = subprocess.PIPE)
            password = password + "\n"
            pobj.stdin.write (password)
            pobj.stdin.write (password)/

It is so curious and I wonder why.It is the same result when substitute smbpasswd with pdbedit.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to