still trying to pass strings to the OS
Bart Nessux
bart_nessux at hotmail.com
Tue Feb 24 16:07:14 EST 2004
More information about the Python-list mailing list
Tue Feb 24 16:07:14 EST 2004
- Previous message (by thread): still trying to pass strings to the OS
- Next message (by thread): still trying to pass strings to the OS
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Cameron Laird wrote: > In article <403A4B77.4090703 at hotmail.com>, > Bart Nessux <bart_nessux at hotmail.com> wrote: > >>Diez B. Roggisch wrote: >> >>>Read this: >>> >>>http://pexpect.sourceforge.net/#faq >>> >>>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: import pexpect password = 'password' child = pexpect.spawn('/usr/bin/passwd root') child.expect_exact('New password:') child.sendline(password) child.expect_exact('Retype new password:') child.sendline(password) Does this look safe? The documentation on the module was lacking. Seems like I should close the process that was spawned. Any tips?
- Previous message (by thread): still trying to pass strings to the OS
- Next message (by thread): still trying to pass strings to the OS
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list