By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,551 Members | 1,159 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,551 IT Pros & Developers. It's quick & easy.

problem with PYTHONPATH on WinXP

P: n/a
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
import sys
sys.path ['', '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
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
D Denholm wrote:
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
Jul 18 '05 #2

P: n/a
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?

Peter Hansen <pe***@engcorp.com> wrote in message news:<Wq********************@powergate.ca>...
D Denholm wrote:
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

Jul 18 '05 #3

P: n/a
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?

Peter Hansen <pe***@engcorp.com> wrote in message news:<Wq********************@powergate.ca>...
D Denholm wrote:
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

Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.