still trying to pass strings to the OS
bart_nessux at hotmail.com
Tue Feb 24 22:07:14 CET 2004
Cameron Laird wrote:
> In article <403A4B77.4090703 at hotmail.com>,
> Bart Nessux <bart_nessux at hotmail.com> wrote:
>>Diez B. Roggisch wrote:
>>>Then you most probably want to use it :)
>>Thank you. That's exactly what I need.
> If you can get your hands on a copy of the February 2004 issue of
> *Sys Admin* Magazine <URL: http://www.samag.com/articles/2004/0402/ >,
> you'll find a bit of encouragement there to pursue Pexpect.
After downloading and installing pexpect... this works for me:
password = 'password'
child = pexpect.spawn('/usr/bin/passwd root')
child.expect_exact('Retype new password:')
Does this look safe? The documentation on the module was lacking. Seems
like I should close the process that was spawned. Any tips?
More information about the Python-list