Applescript Bundle和Python

时间:2010-12-25 20:58:51

标签: python bash shell osx-snow-leopard applescript

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

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

我需要运行的脚本是

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

我想从捆绑包中访问Controller.py

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

1 个答案:

答案 0 :(得分: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)