newbie: popen question

Sebastian Wiesner basti.wiesner at gmx.net
Thu May 28 14:31:38 CEST 2009


<Sean DiZazzo – Donnerstag, 28. Mai 2009 10:11>

> Your best bet is to make sudo not ask for a password.  :)  If you
> don't have the rights, then you can use pexpect to do what you want to
> do.  http://pexpect.sourceforge.net/pexpect.html
> 
> See the second example on that page.
> 
> child = pexpect.spawn('scp foo myname at host.example.com:.')
> child.expect ('Password:')
> child.sendline (mypassword)

The sudo password prompt is very configurable, so changing the configuration 
to allow execution without password input is really the best option.

-- 
Freedom is always the freedom of dissenters.
                                      (Rosa Luxemburg)




More information about the Python-list mailing list