[Pythonmac-SIG] Running Python scripts without full paths

Paul Berkowitz berkowit@silcom.com
Sat, 30 Nov 2002 12:11:32 -0800


On 11/30/02 11:45 AM, "Nicholas Riley" <njriley@uiuc.edu> wrote:

> On Sat, Nov 30, 2002 at 11:42:00AM -0800, Paul Berkowitz wrote:
>> On 11/30/02 11:33 AM, "Nicholas Riley" <njriley@uiuc.edu> wrote:
>> 
>>> Most of Terminal's environment is what is in ~/.MacOSX/environment.plist.
>>> That file is only read on login, which is a real pain, but until
>>> there's some way to force WindowServer to reread it, you're stuck with
>>> trial and error.  A temporary workaround is to run the app you want
>>> directly from the shell instead of using LaunchServices to do it (as
>>> with the 'open' command, the Finder, etc.)  The 'pythonw' script does
>>> exactly this.
>> 
>> Thanks again, Nicholas. So can/should I add a new PATH key to my
>> ~/.MacOSX/environment.plist, to get all future tcsh shell Terminal windows
>> to inherit my scripts folder, as PYTHONPATH now does in the interactive
>> interpreter? Will that work? (I understand that I'll need to log out and in,
>> as OS X user, before it takes effect. I can put up with that for now.)
> 
> Yes, that's one way to do it.  If you just want stuff launched from
> tcsh to be affected, then use ~/.tcshrc instead.

It doesn't work. I would have preferred to have it work for all shells, so I
added this to my ~/.MacOSX/environment.plist file:

    <key>PATH</key>
    <string>/Users/berkowit/Library/Scripts/Python:</string>

That's exactly the same as :

    <key>PYTHONPATH</key>
    <string>/Users/berkowit/Library/Scripts/Python:</string>

which does work. But the PATH key doesn't. I logged out for  OS X and back
in again. here's what I see:

[250-166:~] berkowit% printenv PATH
~/bin/powerpc-apple-darwin:/Users/berkowit/bin:/usr/local/bin:/usr/bin:/bin:
/usr/local/sbin:/usr/sbin:/sbin


What am I doing wrong/ I can try it Kevin's way just for tcsh, but I also
want to 'do shell script' from AppleScript, which uses bash in OS 10.2.
Anyway, why doesn't it work? I added the PATH key and string below DISPLAY
and PYTHONPATH. Since it's an (XML) Dictionary, order shouldn't matter,
should it?

-- 
Paul Berkowitz