spawn* or exec* and fork, what should I use and how ?

Lingyun Yang jing.cheng at
Thu Dec 16 04:27:50 CET 2004

Peter Hansen wrote:
> Lingyun Yang wrote:
>>   I want to use python as a "shell like" program,
>> and execute an external program in it( such as mv, cp, tar, gnuplot)
>> os.execv("/bin/bash",("/usr/bin/gnuplot",'-c "gnuplot < plot.tmp"'))
> I would suggest checking out the "subprocess" module,
> new in Python 2.4.  It subsumes the functionality
> of most of the alternative methods such as execv and
> spawn and os.system(), and provides an arguably cleaner
> interface.
> -Peter

Thank you!

I got the document about subprocess,

More information about the Python-list mailing list