[Pythonmac-SIG] Running Python scripts without full paths

kevin parks kevin@macosx.com
Sun, 1 Dec 2002 05:00:20 +0900


Someone who really understands this ought to put something up on the 
web on this! I know that it is not exclusively a python item, but it is 
relevent. Thanks to the folks on the list i have it working but i am 
still digesting the reasons why it does and what the relationship is 
between the OS X, Terminal.app, the ~/Library/init/tcsh/, files are, 
whether you need a ~/.tcshrc file at all, the
/usr/share/tcsh/examples/ files, /etc, and PYTHONPATH (where is this 
set exactly? for macho and for the other python? is it even needed) and 
the evil mysterious  ~/.MacOSX/environment.plist.
file.

The whole thing is terrible if you ask me. Too complex and not 
documented at all. Someone
said that it is easy if you understand it. Well *if* is the key word 
there and how you get to understand it is another thing all together. A 
look in the bookstore  through OS X books makes
no mention of this.


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