简体   繁体   中英

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:

  1. Created a shell script:

     /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.

  2. Created an 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.

any suggestions?

EDIT: turns out environment variables are not properly set even though /bin/bash is called. 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. Try:

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

thanks to @lain the following applescript solves the problem:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM