在OSX10.6中从“Finder”运行“IDLE3.2s”

2024-10-03 21:34:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用参数“-s”运行IDLE3.2,这样它就可以读取“.pythonstartup”并导出相关模块,更改工作目录等等。下面是我尝试过的:

  1. 创建了一个shell脚本:

    /usr/local/bin/idle3.2 -s
    

    这很正常,但是从Finder运行脚本会打开终端,这不是期望的行为。

  2. 创建了applescript:

    ^{pr2}$

    但是,终端的getrids无法将“-s”参数传递给idle3.2,因此配置文件不会被加载。

有什么建议吗?在

编辑:即使调用了/bin/bash,环境变量也没有正确设置。因此,以下解决了这个问题:

do shell script "/bin/bash; source ~/.profile; /usr/local/bin/idle3.2 -s"

Tags: 模块目录脚本bash终端参数binfinder
2条回答

我认为你的do shell script "/bin/bash; cd /usr/local/bin; ./idle3.2 -s"是在做额外的工作,而且可能做得更简单。尝试:

do shell script "/usr/local/bin/idle3.2 -s"

感谢@lain,下面的applescript解决了这个问题:

do shell script "source ~/.profile; idle3.2 -s"

其中~/.profile为shell(在本例中为/bin/sh)指向.PYTHONSTARTUP的路径和idle3.2的路径

相关问题 更多 >