Entering edit mode
3.9 years ago
Nobody
▴
30
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 ?
You are right that you need
subprocess
to 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
perl
script from withinpython
though, 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: