Milo Land

Make Python 'Apps' and Shortcuts To Run Them on OSX

After experimenting with PyInstaller and Platypus to create a standalone app in OSX with no success, I went the much lower fidelity route. But it was successful, so I'm happy with it.

PyInstaller

Platypus


The goal of this was first to make a standalone app that will run Python script, but second to assign it to a keystroke. I have only tested this with running a Python script, but I can't imagine it would be much more difficult for any other bash script. So here is the process:

do shell script "cd 'path/to/script'; source venv/bin/activate; python main.py"`

**NOTE**: If you don't do the following steps, your shortcut will not work.

References:

https://www.makeuseof.com/tag/applescript-bash-scripts-apps/

https://discussions.apple.com/thread/5048120