problem with PYTHONPATH on WinXP

D

D Denholm

I recently installed Python 2.2 on my WinXP box.

I am having problems figuring out how to create the PYTHONPATH
correctly.

I went to the WinXP SystemProperties > Advanced > Environment
Variables and created a System Variable called PYTHONPATH with the
value:

G:\Python22\lib\site-packages\Pythonwin;
G:\Python22\lib\site-packages\win32;
G:\Python22\lib\site-packages\win32\lib;
G:\Python22\lib\site-packages; G:\Python22\DLLs; G:\Python22\lib;
G:\Python22\lib\lib-tk; G:\Python22;
G:\Python22\lib\site-packages\Numeric; G:\cvslocal;
G:\cvslocal\sim\cmd

But when I run Python from the DOS Command Line, import sys, and then
print the sys.path variable, the path does not contain the last
directory entry:

G:\MySim42>python
Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] on
win32['', 'G:\\Python22\\lib\\site-packages\\Pythonwin',
'G:\\Python22\\lib\\site-pac
kages\\win32', 'G:\\Python22\\lib\\site-packages\\win32\\lib',
'G:\\Python22\\li
b\\site-packages', 'G:\\Python22\\DLLs', 'G:\\Python22\\lib',
'G:\\Python22\\lib
\\lib-tk', 'G:\\Python22',
'G:\\Python22\\lib\\site-packages\\Numeric', 'G:\\cvs
local']
Note that the sys.path contents are the same (taking into account the
differing syntax) as the PYTHONPATH value EXCEPT for the last
directory: "G:\cvslocal\sim\cmd"

I have tried several times but the last entry never shows up... Also,
I have tried deleting the PYTHONPATH enviroment variable completely
but the sys.path does not change. Any suggestions or explanations
would be appreciated.

--Doug
 
P

Peter Hansen

D said:
I recently installed Python 2.2 on my WinXP box.

I am having problems figuring out how to create the PYTHONPATH
correctly.

I would suggest not using PYTHONPATH, but instead use the .pth
file capability defined in and used by site.py. Check the
comments at the top of that file in your python/lib folder,
and make a .pth file with the appropriate contents instead
of mucking with environment variables. One thing to note:
the file extension must be lower case or site.py won't
find the file.

-Peter
 
D

D Denholm

Thanks, that did the trick.

I am still puzzled why the PYTHONPATH environment variable didn't
work. Is it overwritten if *any* *.pth files exist?
 
D

D Denholm

Thanks, that did the trick.

I am still puzzled why the PYTHONPATH environment variable didn't
work. Is it overwritten if *any* *.pth files exist?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top