DAK
DAK

Reputation: 31

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"

Upvotes: 1

Views: 241

Answers (2)

DAK
DAK

Reputation: 31

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

Upvotes: 2

sarnold
sarnold

Reputation: 104110

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"

Upvotes: 2

Related Questions