Running External Programs from Within Python

Cameron Laird claird at
Sun Feb 1 06:46:12 CET 2004

In article <bvhbr7$6rj$07$1 at>,
Dirk Hagemann  <usenet at> wrote:
>RayS wrote:
>> Hi Dirk,
>>> That is very easy: popen()
>>> Check the FAQ and documentation again for popen.
>> That reminds me, I was asked if you can open a bi-directional pipe to 
>> control an external console program on Windows. A guy has compiled 
>> FORTRAN (~4,000 lines of 1980's spaghetti) and wants to add a modern GUI 
>> and a front end method to check data.
>> Can you both send commands to, and read STDOUT from, a remote console app?
>> Ray
>I'm not sure if I got the point, but, for example, with popen I can ping 
>from the console a computer and read the result.
>But sending commands to a remote console is a problem which troubles 
>myself in another context (I asked here yesterday).

The answer is, yes, you can do what you want--assuming that
"remote" means something different to you than the way the
rest of us are reading it.

The kind of wrapping you're describing is a VERY common use
of Python.  Before we provide more details, though, you go
first; specifically, are you thinking of your bi-directional
pipe as a batch operation, or a programmatic one?  Do you
know at the time you launch the Fortran-coded application
all the input it'll need?

Cameron Laird <claird at>

More information about the Python-list mailing list