[Pythonmac-SIG] [MachOPython] starting an application from a Python script?
Jack Jansen
Jack.Jansen@cwi.nl
Wed, 24 Apr 2002 10:44:26 +0200
On Wednesday, April 24, 2002, at 09:33 , Pieter Claerhout wrote:
> You basically will have to use the findertools.launch function. It
> takes one argument, which is the path of the application. If you know
> the creator code of the application, you can do the following thing:
>
> f = macfs.FindApplication('8BIM')
> fPhotoshop = findertools.launch(f)
That's one way, but there are many others. Ideally you would use Launch
Services, but that isn't available in Python yet (it's fairly high on my
todo list, but if someone wants to beat me to it: be my guest!). But
what will also work is using system() on the binary underlying the .app,
as in
system("/Applications/Python.app/Contents/MacOS/python script.py")
And, actually, for the application given (opening a web browser) I think
you should go with the platform standard and use Internet Config to get
at the users' preferred web browser. Applications that have their whole
own set of preferences and ignore the system preferences are not a good
idea, I think.
And, actually, what is the problem with os.spawnv()? It works fine for
me...
--
- Jack Jansen <Jack.Jansen@oratrix.com>
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma
Goldman -