newbie: popen question

thebiggestbangtheory at thebiggestbangtheory at
Thu May 28 12:56:36 EDT 2009

On May 28, 5:31 am, Sebastian Wiesner <basti.wies... at> wrote:
> <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.
> > See the second example on that page.
> > child = pexpect.spawn('scp foo myn... at')
> > 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)

Thanks guys for helping out! very good answers :-)

Before I saw your answers, I tried the following,

output = subprocess.Popen(["sudo","-b", "", "arg1"],

This seemed to push the shell execution process to the background and
because my python program was invoked initially with sudo, it seems I
did not need to enter a passwd again.

Any comments about this..any issues that you see will crop up?

Thanks a ton again.

More information about the Python-list mailing list