user4929740
user4929740

Reputation:

Using Homebrew from python "Error: This command requires a Cask token"

I am trying to install programs with Homebrew by calling it as a subprocess in Python but I get this error: "Error: This command requires a Cask token."

However when I run the exact same command in another terminal it works fine.

I am using this code:

from subprocess import call
call(["brew cask install", "adobe-acrobat-reader", "--force"], shell=True)

Upvotes: 3

Views: 111

Answers (1)

CryptoFool
CryptoFool

Reputation: 23129

You're mixing shell input and pre-parsed arguments in the same call. You either want to separate out all of the individual command line arguments into a list, or you want to put them all in a single string (in which case you need shell=True). The easiest fix for what you have here is:

from subprocess import call
call("brew cask install adobe-acrobat-reader --force", shell=True)

I don't know if this will work, but it is now the correct form for executing the command in question.

Upvotes: 1

Related Questions