problem with PYTHONPATH on WinXP

Discussion in 'Python' started by D Denholm, May 9, 2004.

  1. D Denholm

    D Denholm Guest

    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
     
    D Denholm, May 9, 2004
    #1
    1. Advertising

  2. D Denholm

    Peter Hansen Guest

    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
     
    Peter Hansen, May 10, 2004
    #2
    1. Advertising

  3. D Denholm

    D Denholm Guest

    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 <> wrote in message news:<>...
    > 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
     
    D Denholm, May 19, 2004
    #3
  4. D Denholm

    D Denholm Guest

    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 <> wrote in message news:<>...
    > 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
     
    D Denholm, May 19, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Harald Kirsch

    jython and PYTHONPATH

    Harald Kirsch, Jun 28, 2003, in forum: Python
    Replies:
    1
    Views:
    1,286
    Ype Kingma
    Jun 30, 2003
  2. vincent delft

    CGIHTTPserver looze PYTHONPATH

    vincent delft, Jul 13, 2003, in forum: Python
    Replies:
    1
    Views:
    463
    vincent_delft
    Jul 13, 2003
  3. klappnase

    Re: Python..Tkinter..PYTHONPATH..

    klappnase, Jul 30, 2003, in forum: Python
    Replies:
    0
    Views:
    404
    klappnase
    Jul 30, 2003
  4. Stef Mientki
    Replies:
    9
    Views:
    312
    Gabriel Genellina
    Feb 5, 2007
  5. Andreas Otto
    Replies:
    6
    Views:
    776
    Andreas Otto
    May 21, 2009
Loading...

Share This Page