[Tutor] Running shell command
Brett Wilkins
lupin at orcon.net.nz
Fri May 30 15:36:53 CEST 2008
Just as a side point, wouldn't the easiest way be to run the script
under sudo?
It's safer imho than putting the sudo password in programmatically...
Cheers
--Brett
On 30/05/2008, at 7:21 PM, Alan Gauld wrote:
> "Ricardo DueƱas Parada" <rduenasp at gmail.com> wrote
>
>> When I run the command os.system in python, obviously he asks me
>> for the
>> password, and the program stops until I wirte it. . Is there any
>> way to
>> write the password from the python script?, or what do you
>> recommend me?
>
> os.system is a very basic way of running a program.
>
> You should use the newer subprocess module and the Popen() class.
> There are examples in the documentation.
>
> Also, basic usage is described in my Using the OS topic in my
> tutorial.
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.freenetpages.co.uk/hp/alan.gauld
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list