I'm writing a programme that needs to run on both Linux and Windows and use executables (with parameters) that exist in the path. (Assumed)
Currently I'm having trouble running executables in windows using Subprocess.Call and Subprocess.Popen.
For a code like this, in windows 8
def makeBlastDB(inFile, inputType, dbType, title, outDir):
strProg = 'makeblastdb'
strInput = '-in ' + inFile
strInputType = '-input_type ' + inputType
strDBType = '-dbtype ' + dbType
strTitle = '-title ' + title
strOut = '-out ' + os.path.join(os.sep, outDir, title)
cmd = [strProg, strInput, strInputType, strDBType, strTitle, strOut]
result = Popen(cmd, shell=True)
'makeblastdb' is not recognized as an internal or external command,
operable program or batch file.
Ok here is how I got it to work.
env = os.environ proc = subprocess.Popen(args, env=env)