executable "wrapper" gui -- advice sought

Mark C Favas mark at chem.uwa.edu.au
Sun Apr 23 02:29:09 CEST 2000


"Grant Goodyear" <g2boojum at hotmail.com> writes:

>I'm in the process of writing an exceedingly simple gui that will take an
>already existing binary executable and input text file (I don't want to
>break the
>working system!) and allow the user to modify the input arguments,
>if desired, and then start the executable.  That part is straightforward.
>What I'm not sure how to do is to capture the executable's std out as
>it's generated.  My goal is to echo that output to a seperate window, and
>also to use it to generate a periodically updated html "status report" so
>that the program's progress can be monitored remotely.  Working
>through the gui aspects isn't all that difficult, but I have _no_ idea how
>to grab the executable's std out _while it is running_ and then have the
>python gui do something (anything!) with that data.  Any advice?

Have a look at the on-line module documentation for "commands" (Unix only),
and "popen2" (also Unix, though Mark Hammond's win32 package contains a working
pipe implementation amongst other goodies). If your executable writes to
/dev/tty instead of stdout you'll need to play with the pseudo tty module,
"pty" (doco says available for IRIX & Linux, but it's pretty easy to get it
working for Solaris and Tru64 Unix (nee Digital Unix)). Watch out for buffering
of the output, also.

--
Email  - mark at chem.uwa.edu.au      ,-_|\                           Mark C Favas
Phone  - +61 9 380 3482           /     \               Department of Chemistry
Fax    - +61 9 380 1005      ---> *_,-._/   The University of Western Australia
                                       v                               Nedlands
Loc    - 31.97 S, 115.81 E                               Western Australia 6009



More information about the Python-list mailing list