Run bash script with python - TypeError: bufsize must be an integer
You should specify the command as a list. Beside that, main option (x
) is missing.
def tarfile(path): call(["tar", "xvf", path])
BTW, Python has a tarfile
module:
import tarfilewith tarfile.open("/root/tryit/output.tar") as tar: tar.extractall() # OR tar.extractall("/path/to/extract")