[PD] launching pd from python

altern altern2 at gmail.com
Fri Sep 2 17:37:56 CEST 2005

august(e)k dio:
>>>actually, I think if the Pd-0.38-4-extended-RC1.app is in the same
>>>directory where you start python, then you want to try something like
>>>pdexc = os.path.join(execdir,
>>> "./Pd-0.38-4-extended-RC1.app/Contents/Resources/bin/pd")
>>>  ^
>>>  |
>>>  |  -> notice the "./"
>>hi august
>>i tried and it doesnt seem to make any difference. Looks like Python
>>doesnt like something about PD.
> nico,
> sorry, I wrote that email early in the morning.  the only reason for doing
> the "./" would be trying to spawn a process from the same directory as
> where you ran python.  but, int he mean time, I see in the code that you
> have set up the paths properly.
> However, I was farting around with subprocesses in python yesterday (for
> another reason).  I can start another app without any probs using
> os.system( ).   I had some problems with os.spawnl() calls.   I also
> tried using python's subprocess wrapper, Popen() -> but, that just calls
> execl(), or spawnl() or system() as it sees fit.   Today, I will try to
> run os.system() in a thread and see if I can get decent behavior.  The app
> I am trying to run is mplayer.
> -august.


I tried.os.system() and it does open Pd properly but python waits until 
PD is finished to keep running. I need both Python and PD to work 
concurrently. Same for os.execl()

This is as far as i got. I use

execdir = os.path.dirname(sys.argv[0])
launcher = os.path.join(execdir, "launcher")
os.spawnl(os.P_NOWAIT, launcher, '')

to run a shell script like this:
-nogui ~/Desktop/mypythonapp.app/Contents/Resources/audio.pd

this is pretty close to what i if not because of the startup flags not 
working. I tried to use os.spawnl to open other apps and it doesnt work 
either. Maybe the process is somehow under control of Python and doesnt 
like it?
Bob in the apple python list suggested to use Python 2.4's 
LaunchServices module, but i am running 2.3, or pyObjC but i would like 
to find a crossplatform solution.

i keep seearching ...


More information about the Pd-list mailing list