os.system issues
Christian Heimes
lists at cheimes.de
Thu Feb 5 09:08:14 EST 2009
Youri Lammers schrieb:
> Ok,
>
> I want to run a program called 'muscle' with my python script,
> muscle uses the following command:
> 'muscle.exe -in filename -out filename'
> so far I got:
>
> import os
> args = ['-in filename', '-out filename']
> os.system('E:\Programs\muscle\muscle.exe args')
>
> However, when I run this nothing happends, no error message, nothing.
>
> So what am I doing wrong here?
For starters you should use the subprocess module instead of os.system.
Next you have either write "E:\\..." or r"E:\..." (note the trailing 'r').
Try this:
import subprocess
subprocess.check_call(['E:\\Programs\\muscle\\muscle.exe', '-in',
'filename', '-out', 'filename'])
Christian
More information about the Python-list
mailing list