python - running a binary file in python2.7 on linux -
i'm having issues running external program in python using popen pass multiple variables:
#!/usr/bin/env python import sys import os import shlex, subprocess = raw_input("enter number:") b = raw_input("enter file:") c = raw_input("enter dir search:") subprocess.popen(['/bin/sh', "./catnum.bin", "-m", a, "--remove", "-o results.txt", b, c])
you use call instead:
from subprocess import call call(["cactnum.bin", "-m",a, "--remove", "-o results.txt", b, c])
however per comment of j.f. sebastian
the real issue invalid/unnecessary /bin/sh call b) "-o results.txt"
should written "-o", "results.txt"
(2 args) i.e., correct call is: subprocess.check_call(["./catnum.bin", "-m", a, "--remove", "-o", "results.txt", b, c]) if catnum.bin executable
Comments
Post a Comment