[英]Running “IDLE3.2 -s” from the “Finder” in OS X 10.6
I want to run IDLE3.2 with the argument "-s" so it can read ".pythonstartup" and export relevant modules, change the working directory and etc. Here is what I have tried: 我想用参数“-s”运行IDLE3.2所以它可以读取“.pythonstartup”并导出相关模块,更改工作目录等。这是我尝试过的:
Created a shell script: 创建了一个shell脚本:
/usr/local/bin/idle3.2 -s
this works allright, however running the script from the Finder opens up the Terminal, which is not the desired behavior. 这很好用,但是从Finder运行脚本会打开终端,这不是理想的行为。
Created an applescript: 创建了一个AppleScript:
do shell script "/bin/bash; cd /usr/local/bin/; ./idle3.2 -s"
this get rids of the terminal however fails to pass "-s" argument to idle3.2 so the configuration file is not loaded. 这个get终端然而无法将“-s”参数传递给idle3.2,因此未加载配置文件。
any suggestions? 有什么建议么?
EDIT: turns out environment variables are not properly set even though /bin/bash is called. 编辑:即使调用/ bin / bash, 也没有正确设置环境变量 。 so the following solves the problem:
所以以下解决了这个问题:
do shell script "/bin/bash; source ~/.profile; /usr/local/bin/idle3.2 -s"
I think your do shell script "/bin/bash; cd /usr/local/bin; ./idle3.2 -s"
is doing extra work, and can probably be done more simply. 我认为你的
do shell script "/bin/bash; cd /usr/local/bin; ./idle3.2 -s"
正在做额外的工作,而且可以更简单地完成。 Try: 尝试:
do shell script "/usr/local/bin/idle3.2 -s"
thanks to @lain the following applescript solves the problem: 感谢@lain以下的AppleScript解决了这个问题:
do shell script "source ~/.profile; idle3.2 -s"
where ~/.profile points the shell (in this case /bin/sh) the path for .PYTHONSTARTUP and the path for idle3.2 其中〜/ .profile指向shell(在本例中为/ bin / sh).PYTHONSTARTUP的路径和idle3.2的路径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.