MacPython os.system like?

Greg Ewing (using news.cis.dfn.de) me at privacy.net
Thu Feb 20 23:13:41 EST 2003


Andres Rosado wrote:
> I am trying to port my application (pySignature) to Mac. Almost 
> everything works nice, except the os.system call. After researching on 
> Google, MacPython doesn't support this call. Is there any way to execute 
> a program in Mac OS 9.x without using os.system?

There are ways, yes. One way is to send an AppleEvent
to the Finder asking it to launch the program. MacPython
comes with some modules for AppleEvent support, but
it'll take some work to figure out how to use them.

Another way would be to make the appropriate call
to the Process Manager directly, but I've never tried
to do that, and I don't know if it's even exposed in
MacPython's MacOS modules.

Either way, you're not going to get all of the
functionality of the Unix system() function. For
one thing, MacOS 9 has no notion of standard input
or output, and the only things you can pass as
arguments to a program when launching it are files
(no options or other arbitrary strings).

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list