How to control app from Python?

Pierre Imbaud pierre at saiph.com
Sat Oct 30 02:04:10 EDT 1999


Andy Fox wrote:
> 
> Hi,
> 
> I'd like to use Python to control another (non Python) app.  Ideally, I
> would like to start the other app, then tell it to do a few things, then
> stop it.
> 
> I've done some experimenting with os.system() and os.popen().  It is
> remarkably easy to start an app, but not so easy to stop it.
> 
> I've found some really interesting looking functions in the win32pipe
> module, but I'm at a loss how to use them.  For example, there's a
> 'popen' 'popen2' 'popen3' and 'popen4.'  There must be a reason for
> having four apparently similar functions.
> 
> I'm using 1.5.2 on a Windows NT box.  I've been swimming around in
> documentation for the last few days, and doing some experimenting, but
> could use some guidance.
> 
> Any suggestions?
> --
> Andy Fox
I did this a few times, with no difficulty, but on UNIX! might be quite
different on windows...
python library essentially wraps C libraries and system calls. So
whatever U do, first wonder how U wud like it done in C or C++, and then
use python to do it.
The main point in your case seems to be: how carefull the app U launch
is to what U will tell it?
 - the app will take the time to read a stream: just open a pipe to it
(there is a function launching an app with pipe open to it).
 - the app is event driven: U need to send it signal, then.
-- 
Pierre Imbaud <pierre at saiph.com>
12 Rue des Bosquets 91480 Quincy Sous Sénart France
Tel:  01 69 00 94 57 Fax 79 65




More information about the Python-list mailing list