1

I want to start a pythonscript by pushing a Button in a swift macOS application. I come up with:

let process = Process()
process.launchPath = "/usr/bin/python3"
process.currentDirectoryPath = "\(NSHomeDirectory())" + "/PycharmProjects/untitled5"
process.arguments = ["myscript.py"]
process.launch()

but I get "launch path not accessible" error by executing. If I change launchPath to:

process.launchPath = "/usr/bin/python"

everything works fine, but now I getting python compiling errors because myscript is written in python3.6.0, I have to use python3 because of using a library. When I open Finder and go to "/usr/bin/python3" it says not found, but python3 is installed, I used it in Pycharm and I'm also able to start python3 in terminal. In terminal "python3 ~/PycharmProjects/untitled5/myscript.py" works.

2
  • 3
    This smells like an XY problem. Commented Mar 5, 2017 at 15:04
  • What does which python3 say? Are you sure, that it points to "/usr/bin/python3"? Commented Mar 5, 2017 at 15:07

1 Answer 1

1

On your terminal type

which python3

this will return the path that is accessed when you run python3 from the command line

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.