[Tutor] Running shell command

Alan Gauld alan.gauld at btinternet.com
Fri May 30 09:21:09 CEST 2008


"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 




More information about the Tutor mailing list