[Tutor] PYTHONPATH environment variable

Magnus Lycka magnus@thinkware.se
Sun Nov 3 06:54:01 2002


At 20:51 2002-11-02 -0800, Lance wrote:
>Hi All,
>
>I added a directory to the end of my PYTHONPATH environment variable
>(running on Windoze XP). When print sys.path, the added directory is not at
>the end.

Of course. If you add something to PYTHONPATH you want
to be certain that this is really run. Then you want it
first in sys.path. Otherwise it would be impossible to
use PYTHONPATH to override default behaviour.

>Instead the Python installation directory is at the end. My
>understanding is that Python looks for files in PYTHONPATH order. How can I
>put something at the end and ensure it will truly be at the end?

import sys
sys.path.append(directory)


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se