You are not logged in.
Hi,
I'm working at a python program that can for example convert file1 to file2 using the convert program:
I start it via os.spawnlp:
os.spawnlp(os.P_WAIT, 'convert', 'convert', 'file1', 'file2')
Now my problem is, I cannot pass any more arguments. I'd like to be able to do something like this:
os.spawnlp(os.P_WAIT, 'convert', 'convert', 'file1', 'file2','-argument1')
but if I try that, I'm only getting alot of ASCII salad.
The other ways of spawning processes I found here don't seem to work either.
Offline
os.spawnlp(os.P_WAIT, 'convert', ['convert', 'file1', 'file2','-argument1'])
I would recommend getting familiar with subprocess.Popen(). They're pushing it as the defacto now. Many conversion examples are in the docs. help(subprocess.Popen).
Offline
Ok thanks I'll use that then.
I also found out that you can pass commands + arguments as lists, and this works nicely as long as you do pass an argument. If you don't (pass "" instead of "-foo"), weird errors occur.
Offline