[Edu-sig] PEPTALK: path sanity and newbie mental health -- please help

Jason Cunliffe Jason Cunliffe" <jason.cunliffe@verizon.net
Mon, 7 Jul 2003 10:19:59 -0400


> Use the force, Luke. Or the os.environ dictionary. But good luck, either
> way. Hope this long message helps.

Leif, Yes thanks  - great answer! ..I feel better already.

os.environ
aaah -- what a a wor[l]d of difference between

http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=environment+pytho
n
http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=environ+python


> ... you could enable such behavior by putting the following
> in C:\PYTHON22\lib\site-packages\sitecustomize.py :
>
>   import sys
>   sys.path.append('C:\\PYTHON22\\lib\\site-packages\\jabber')
>   for p in sys.path: print p
>   del p, sys

hmm...
Like I said sitecustomize.py does not work for me :-(

For example I put a single line in
C:\PYTHON22\lib\site-packages\sitecustomize.py

import sys

Then run IDLE

>>> sys
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in ?
    sys
NameError: name 'sys' is not defined
>>>

For some reason Python is not running my sitecustomize.py
But IDLE does show the file on its Path browser

Any ideas?
Is there something you have to do to activate sitecustomize.py files ?

Both your response and Arthur's imply I am doing something special to
require path manipulation.
Apart from installing packages and modules by other people, my need is very
simple..
I store all my own work on external firewire drives. So even "helloworld.py"
need to be accessible in a folder like
M:\\jasonic\\python

You've provided some valuable strategies.
I think I will try to write a sys.path.save() script hack to set my paths
quickly from inside python. I imagine I'll need to restart idle but at least
I'll have a more portable solution. Presumably it is always safe to edit
PYTHONPATH in autoexec.bat from Python. I hope I don't also have to restart
windows.

thanks again
Jason