Calling multiple programs with subprocess

Amit Uttamchandani amit.uttam at gmail.com
Fri Apr 23 21:51:04 CEST 2010


On Thu, Apr 22, 2010 at 10:12:47PM -0400, Dave Angel wrote:
> amit wrote:
> >How does one go about calling multiple programs using subprocess?
> >
> >This is the program flow:
> >
> >C:\> wrenv.exe
> >C:\> make clean
> >..
> >..
> >
> >The 'wrenv.exe' is necessary since it sets up the proper environment
> >for building. How do I use subprocess to execute 'wrenv.exe' and then
> >the 'make clean' command.
> >
> >Any help is appreciated.
> >
> >Thanks,
> >Amit
> >
> One way is to write a batch file (since you're on Windows), and
> execute that with shell=True.
> 
> It's not the only way, or the most efficient.  But it's most likely
> to work, without knowing anything more about those two programs.
> 
> DaveA
> 

Thanks Dave.

That's actually a good idea and in this case probably the only way that
this would work. I can auto-generate the batch file from the python
script with the parameters that I need and just execute that with the
subprocess.

I wish there was a cleaner was as well.

But thanks for tip!

Amit



More information about the Python-list mailing list