4

I try to open the calculator application with my Python Shell, but it says permission denied here is the final line of what comes out

"PermissionError: [Errno 13] Permission denied"

    import subprocess
    subprocess.call('/Applications/Calculator.app')

I am doing this on a mac, so anyone with a mac should have this application.

0

1 Answer 1

6

Because is not an executable file. To run the MacOS desktop application you have to run the executable from inside of the Application package.

In case of calculator run try this:

import subprocess
subprocess.call('/Applications/Calculator.app/Contents/MacOS/Calculator')

If you want to run any application without digging around for the executable file in the package (it is not always the same name as the app), use this:

subprocess.call(["/bin/bash","-c","open /Applications/Calculator.app"])
Sign up to request clarification or add additional context in comments.

Comments

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.