[Pythonmac-SIG] opening an application from python
altern
altern2 at gmail.com
Fri Sep 2 13:13:34 CEST 2005
Bob Ippolito(e)k dio:
>
> On Sep 2, 2005, at 1:29 AM, altern wrote:
>
>> hi
>>
>> I am trying to launch a sound application (Pure Data) from a python
>> program. For this I am using this code:
>> #
>> execdir = os.path.dirname(sys.argv[0])
>> pdexc = os.path.join(execdir,
>> "/Pd-0.38-4-extended-RC1.app/Contents/MacOS/Pd")
>> arg = os.path.join(execdir, "audio.pd")
>> os.spawnl(os.P_NOWAIT, pdexc, arg)
>> # etc ...
>>
>> i need to pass arguments to the application, PD is a command line
>> application so it can be run from the terminal and several start up
>> flags can be passed.
>>
>> My problem is that it kind of runs but not properly. I get the process
>> running, it is there if i do 'top' on the terminal. But the application
>> never fully opens. I was wondering if there is some problem with doing
>> this from Python, or if i should be using some other command.
>
>
> You should be using LaunchServices to launch the process with an open
> document event, directly or indirectly. You can do that with PyObjC,
> or with Python 2.4's LaunchServices module, or with /usr/bin/open (man
> open).
>
> -bob
quite obvious, of course. sometimes it is difficult to see in front of
oneself :)
thanks bob, i will try all this
--
altern
More information about the Pythonmac-SIG
mailing list