Reputation: 4609
I'm using Python to call cscope
internally. For this I'm using subprocess.call
.
The problem is that it's not working without shell=True
The following code works as expected:
import subprocess
subprocess.call("cscope -d -L0'temp'", shell=True)
But the following doesn't, it returns with 0
status code, but there is no output
import subprocess
subprocess.call(["cscope", "-d", "-L0'temp'"])
Any ideas as to why the above is happening?
Upvotes: 4
Views: 1296
Reputation: 180401
Don't quote the arguments, the args are passed directly to the process without using the shell when shell=False:
subprocess.call(["cscope", "-d", "-L0","temp"])
You should use check_call:
from subprocess import check_call
check_call(["cscope", "-d", "-L0", "temp"])
Upvotes: 3