0

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.communicate()

I am getting "Permission denied" when running this script.

1
  • Can you please verify that the problem occurs on the script as posted, and not just on your full version? Can you also include the command you used to run it, and the complete and unabbreviated error messages? Commented Oct 10, 2018 at 18:20

1 Answer 1

2

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.stdout
stderr = result.stderr
Sign up to request clarification or add additional context in comments.

2 Comments

Why would it give a "permission denied" instead of a "No such file or directory" though?
I dunno; indeed, I get "no such file or directory". Maybe the OP is on some godforsaken "personal productivity" platform?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.