[Pythonmac-SIG] Running Python scripts without full paths

Nicholas Riley njriley@uiuc.edu
Sat, 30 Nov 2002 14:22:06 -0600


On Sat, Nov 30, 2002 at 12:11:32PM -0800, Paul Berkowitz wrote:
> On 11/30/02 11:45 AM, "Nicholas Riley" <njriley@uiuc.edu> wrote:
> > 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>

You seem to be including the trailing colon because you think it means
something??  You need to at least include the default PATH
(/usr/bin:/bin:[home dir]) in the PATH you set in
~/.MacOSX/environment.plist, otherwise bad things can happen.
WindowServer could be throwing out your PATH in an effort to sanity
check, in fact.

I just added /blah/bin to my PATH in ~/.MacOSX/environment.plist,
logged out, logged back in, and there it was.  When I put only
/blah/bin in there, my shell started complaining that it couldn't find
anything (not surprisingly).  So be careful.

> 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

Something else might be overwriting your path.  Remember that you're
using tcsh whose parent is login whose parent is Terminal whose parent
is the WindowServer.  Check the initial environment of Terminal using
'ps -eww'.  If that contains your PATH as you've set it, then follow
the chain of initial environments until you find the one that doesn't
contain your set PATH.

> 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?

No.  It's better to use Property List Editor than editing the file
directly, that way you don't have the potential of XML syntax errors
causing problems.  If in doubt, use the 'pl' program (see my previous
email) to print out the contents of the property list in old-style
plist format, which happens to be much more compact and human-readable
than the XML format.

-- 
=Nicholas Riley <njriley@uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>
        Pablo Research Group, Department of Computer Science and
  Medical Scholars Program, University of Illinois at Urbana-Champaign