[Pythonmac-SIG] reposting: Q: emulating os.system() on macs?

Jack Jansen jack@oratrix.nl
Thu, 02 Dec 1999 14:25:48 +0100


I'm afraid this is impossible, as MacOS has no concept of stdin/stdout/stderr. 
You can make this work for some applications, on a per-application basis, but 
there is no general solution.

If you can give some details on the program you're trying to execute someone 
here may be able to come up with a solution that'll work for this particular 
case.

> I'm in the process of planning to port a Python application that
> is being developed on Linux to the Mac. One of the many questions I
> have is how to emulate in Python/Mac something like:
> 
> 
> def doit(infile, outfile, errfile, exefile):
>     """
>     execute "exefile" on "infile" and write "outfile" and "errfile"
>     """
>     cmd = '%s < "%s" > "%s" 2> "%s"'%(exefile, infile, outfile, errfile)
>     os.system(cmd)
>     return (outfile, errfile)

--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm