Here's the scenario. I want to run a command line program from within a python script. The command would generate a file after executing which I would read into an for some further operations. I want to pass a filename as a function parameter.
def myfunc(myinputfile,myoutputfile):
cmd = "mycommand -i %s -o %s" %(myinputfile,myoutputfile)
I tried using subprocess.call but apparently It requires me to write commandname and arguments as seperate entries of list. Is there any other way I way to do this. Also, it is important that the command executes before proceeding as I want to read the output from file into a variable later on in the script.