Search code examples
pythonbashshellosx-snow-leopardapplescript

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?


Solution

  • 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)