[Tutor] executing multiple binaries from a python script

Adil Hasan hasan at in2p3.fr
Thu Oct 23 12:35:38 EDT 2003


Hello,
       Can someone help me? I am trying to write a little script that will
 execute binaries one after the other. Ideally, I'd like to be able to
 create the shell session in the constructor, execute some commands, and
 then close the session. On the unix command line what I do is:

 shell> commandA  (this creates my session)
 shell>     commandB
 shell>     commandC
 shell>     commandD
 shell> commandE (ends my session)

 I'd like to be able to do this within a python class. I thought I might
 be able to use popen2, but that doesn't work (I get broken pipe errors).
 I was thinking about fork() but I cannot understand how to put this into
 a class like structure (ideally I'd like to get some handle to the fork
 and then pass that to the methods to allow me to run the other commands).

 Does anyone have an idea how to do this?
 thanks, adil





More information about the Tutor mailing list