Applescript Bundle和Python

Jos*_*ley 4 python bash shell applescript osx-snow-leopard

基本上我想从applescript包中启动一个Python脚本

所以我在捆绑包中捆绑了文件(Controller.py)

我需要运行的脚本是

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

我想从bundle中访问Controller.py

那么如何通过bash访问捆绑文件?

Gor*_*son 5

使用path to me得到的AppleScript bindle的位置,那么你的脚本相对找到它:

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)
Run Code Online (Sandbox Code Playgroud)