Josh Fradley
Josh Fradley

Reputation: 562

Applescript Bundle and Python

Basically i want to launch a Python script from within an applescript bundle

So i have bundled the file (Controller.py) within the bundle

The script i need to run is

do shell script "PYTHONPATH=/Applications/gtk/inst/lib/python2.6/site-packages python /path/to/Controller.py

I want to access Controller.py from within the bundle

So how to you access bundled files via bash?

Upvotes: 4

Views: 930

Answers (1)

Gordon Davisson
Gordon Davisson

Reputation: 125708

Use path to me to get the location of the AppleScript bindle, then find your script relative to it:

set controller_script to (path to me as string) & "Contents:Resources:Controller.py"
do shell script "PYTHONPATH=/Applications/gtk/inst/lib/python2.6/site-packages python " & (quoted form of POSIX path of controller_script)

Upvotes: 5

Related Questions