[Tutor] Correct way to call an outside program?

Alan Gauld alan.gauld at btinternet.com
Thu Mar 13 05:57:46 CET 2008

"Allen Fowler" <allen.fowler at yahoo.com> wrote

> I need to call an external command line .exe utility from my Python 
> script.
> What is the best way to capture the output (if any) and (optionally)
> direct it to my normal standard output?
> There seem to be many options...

Historically there have been lots of methods introduced howeever
the most recent and officially correct way is now tyo use the
subprocess module. There are examples on the web pages
to show what you want.

Or read the Using the OS topic in my tutorial for the basics.


Alan Gauld
Author of the Learn to Program web site
Temorarily at:

More information about the Tutor mailing list