run a tool from python
Hello,
I have a command that it is executed normally in a directory where we will generate our results, when we want to do it from linux it suffices to be in the directory "result" and run the command (perl -input .....). I want to run it from python.... I created my variable: cmd = perl input.... subprocess.cal (cmd, shell = true) except that here I am not in the directory where I have to generate my results, do you have a solution ?
• 1,321 views
•
link
0 answers
No answers yet.
Log in to answer this question.
You are right that you need
subprocessto run the command. You can either express your full paths in the command, or useos.chdir()to move to new folders.If you're running a
perlscript from withinpythonthough, this strikes me as not the most efficient process.I'm going to leave the post open for now, but note that this is not obviously a bioinformatics question so may be closed.
i knew i have to use os.chdir () but i dont know how to apply it. os.chdir (my path) and the line after I type my command and after my subprocess.call?
How about: