hi
Few months ago i was asking about how to launch pd from python, at that time i was getting some weird error i couldnt solve. I finally found what was wrong (forgot to pass the path to pd with \ ) but now i have another issue to solve.
Basically i am using this code to load PD and open a patch
import os args = '-nogui', 'mypatch.pd' # this is a tupple with the arguments for pd, the last is the file to open os.spawnv(os.P_NOWAIT, 'C:\Program Files\pd\bin\pd.exe', args)
It opens pd and the patch fine. But the -nogui doesnt work. I tried with other flags like -noaudio and this time they do work. I am wondering if this has anything to do with the pd console or something like that. Maybe it doesnt like being launched from python? As a test I explored this other method:
os.startfile(run.bat)
where the run.bat contains the comand pd -nogui mypatch.pd
this works fine running pd as process only, but the console of the .bat stays open and i am trying to avoid any kind of window, i want PD to be invisible.
I am testing it on windows XP at the moment but I want to use a crossplatform method, this is another reason to avoid the .bat
any one has some ideas about how to get this running as i need?
many thanks
enrike
I think I figured this out... the first argument in the list should be the name of the program. So try:
import os args = 'C:\Program Files\pd\bin\pd.exe', '-nogui', 'mypatch.pd' os.spawnv(os.P_NOWAIT, 'C:\Program Files\pd\bin\pd.exe', args)
(I tried running pd from python on my linux system and debugged the problem by replacing pd with /bin/echo. Linux highly recommended :)
cheers Miller
On Mon, Aug 28, 2006 at 10:57:43PM -0700, altern wrote:
hi
Few months ago i was asking about how to launch pd from python, at that time i was getting some weird error i couldnt solve. I finally found what was wrong (forgot to pass the path to pd with \ ) but now i have another issue to solve.
Basically i am using this code to load PD and open a patch
import os args = '-nogui', 'mypatch.pd' # this is a tupple with the arguments for pd, the last is the file to open os.spawnv(os.P_NOWAIT, 'C:\Program Files\pd\bin\pd.exe', args)
It opens pd and the patch fine. But the -nogui doesnt work. I tried with other flags like -noaudio and this time they do work. I am wondering if this has anything to do with the pd console or something like that. Maybe it doesnt like being launched from python? As a test I explored this other method:
os.startfile(run.bat)
where the run.bat contains the comand pd -nogui mypatch.pd
this works fine running pd as process only, but the console of the .bat stays open and i am trying to avoid any kind of window, i want PD to be invisible.
I am testing it on windows XP at the moment but I want to use a crossplatform method, this is another reason to avoid the .bat
any one has some ideas about how to get this running as i need?
many thanks
enrike
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
hi miller
it works on XP... funny. is there any special reason to have to pass pd as first argument? i am curious now.
i havent tested it yet on OSX, I will try tomorrow.
many thanks!
enrike
Miller Puckette escribió:
I think I figured this out... the first argument in the list should be the name of the program. So try:
import os args = 'C:\Program Files\pd\bin\pd.exe', '-nogui', 'mypatch.pd' os.spawnv(os.P_NOWAIT, 'C:\Program Files\pd\bin\pd.exe', args)
(I tried running pd from python on my linux system and debugged the problem by replacing pd with /bin/echo. Linux highly recommended :)
cheers Miller
On Mon, Aug 28, 2006 at 10:57:43PM -0700, altern wrote:
hi
Few months ago i was asking about how to launch pd from python, at that time i was getting some weird error i couldnt solve. I finally found what was wrong (forgot to pass the path to pd with \ ) but now i have another issue to solve.
Basically i am using this code to load PD and open a patch
import os args = '-nogui', 'mypatch.pd' # this is a tupple with the arguments for pd, the last is the file to open os.spawnv(os.P_NOWAIT, 'C:\Program Files\pd\bin\pd.exe', args)
It opens pd and the patch fine. But the -nogui doesnt work. I tried with other flags like -noaudio and this time they do work. I am wondering if this has anything to do with the pd console or something like that. Maybe it doesnt like being launched from python? As a test I explored this other method:
os.startfile(run.bat)
where the run.bat contains the comand pd -nogui mypatch.pd
this works fine running pd as process only, but the console of the .bat stays open and i am trying to avoid any kind of window, i want PD to be invisible.
I am testing it on windows XP at the moment but I want to use a crossplatform method, this is another reason to avoid the .bat
any one has some ideas about how to get this running as i need?
many thanks
enrike
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hallo, altern hat gesagt: // altern wrote:
it works on XP... funny. is there any special reason to have to pass pd as first argument? i am curious now.
spawnl( mode, path, ...) spawnle( mode, path, ..., env) spawnlp( mode, file, ...) spawnlpe( mode, file, ..., env) spawnv( mode, path, args) spawnve( mode, path, args, env) spawnvp( mode, file, args spawnvpe( mode, file, args, env)
[...]
The "l" and "v" variants of the spawn*() functions differ in how command-line arguments are passed. The "l" variants are perhaps the easiest to work with if the number of parameters is fixed when the code is written; the individual parameters simply become additional parameters to the spawnl*() functions. The "v" variants are good when the number of parameters is variable, with the arguments being passed in a list or tuple as the args parameter. In either case, the arguments to the child process must start with the name of the command being run.
http://docs.python.org/lib/os-process.html
Frank Barknecht _ ______footils.org_ __goto10.org__