Skip to content Skip to sidebar Skip to footer

Permission Denied When Using Bash Command In Python

I have a python script which looks something like this. from subprocess import Popen, PIPE process = Popen(['git log'], stdout=PIPE,stderr=PIPE) stdout, stderr = process.communica

Solution 1:

There is no command whose name is git log; you want the command git with the argument log.

Tangentially, if you are on Python 3.5 or higher, you want to upgrade to subprocess.run().

from subprocess import run, PIPE

result = run(['git', 'log'], stdout=PIPE, stderr=PIPE, text=True, check=True)
stdout = result.stdoutstderr = result.stderr

Post a Comment for "Permission Denied When Using Bash Command In Python"