On Tue, Sep 15, 2009 at 4:01 PM, Russell Jackson
<ru...@rcjacksonconsulting.com> wrote:
<snip>
> Attempted code in Python 3: (Doesn't work either)
<snip>
>         cmd = ' passwd {0}'.format(user)
>         pipe = Popen(p4 + cmd, shell=True, stdin=PIPE, stdout=PIPE,
> stderr=PIPE, universal_newlines=True)

You're not specifying the command to Popen correctly (a very common problem).

(Shameless plug: I *really* wish someone would look at my docs patch
to explain this common problem -- http://bugs.python.org/issue6760)

Corrected code:

cmd = [p4, 'passwd', user]
pipe = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE,
universal_newlines=True)

Though your code may have other problems too (I didn't check).

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to