.pth configuration method not working

Discussion in 'Python' started by Mark, Feb 3, 2007.

  1. Mark

    Mark Guest

    Sys.path doesn't recognize any directories that I add using the .pth
    method. I'm running Windows XP if that helps diagnose the problem.

    Here is what I've done:

    The original output of sys.path:
    ['C:\\Python25\\Lib\\idlelib', 'C:\\WINDOWS\\system32\\python25.zip',
    'C:\\Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python25\\lib\\plat-
    win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\
    \site-packages']

    I've added a file "MyPaths.pth" to "C:\Python25\". MyPaths.pth
    contains one line that reads: C:\Python25\MyModules. For some reason
    sys.path won't ever recognize that C:\Python25\MyModules exists. This
    is very frustrating because I know that this method is supposed to
    work. ANY help would be appreciated.

    Thanks in advance,
    Mark
    Mark, Feb 3, 2007
    #1
    1. Advertising

  2. Mark

    John Machin Guest

    On Feb 4, 10:03 am, "Mark" <> wrote:
    > Sys.path doesn't recognize any directories that I add using the .pth
    > method. I'm running Windows XP if that helps diagnose the problem.
    >
    > Here is what I've done:
    >
    > The original output of sys.path:
    > ['C:\\Python25\\Lib\\idlelib', 'C:\\WINDOWS\\system32\\python25.zip',
    > 'C:\\Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python25\\lib\\plat-
    > win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\
    > \site-packages']
    >
    > I've added a file "MyPaths.pth" to "C:\Python25\". MyPaths.pth
    > contains one line that reads: C:\Python25\MyModules. For some reason
    > sys.path won't ever recognize that C:\Python25\MyModules exists. This
    > is very frustrating because I know that this method is supposed to
    > work. ANY help would be appreciated.
    >


    If you were to do a Google search for "pth" in this newsgroup, the
    first 2 or 3 results would tell you what to do, *and* point you to
    which section of the Python documentation covers .pth files.

    BTW, are YourModules specific to Python 2.5? If not, what do you plan
    to do when Python 2.6 is released?

    HTH,
    John
    John Machin, Feb 3, 2007
    #2
    1. Advertising

  3. En Sat, 03 Feb 2007 20:03:03 -0300, Mark <> escribió:

    > Sys.path doesn't recognize any directories that I add using the .pth
    > method. I'm running Windows XP if that helps diagnose the problem.


    Using Python 2.4.3 on WinXP too. My Python is on C:\apps\Python. Works
    fine for me:

    C:\APPS\PYTHON>python -c "import sys; print sys.path"
    ['', 'D:\\WINDOWS.0\\system32\\python24.zip', 'C:\\APPS\\PYTHON',
    'C:\\APPS\\PYT
    HON\\DLLs', 'C:\\APPS\\PYTHON\\lib', 'C:\\APPS\\PYTHON\\lib\\plat-win',
    'C:\\APP
    S\\PYTHON\\lib\\lib-tk', 'C:\\APPS\\PYTHON\\lib\\site-packages',
    'C:\\APPS\\PYTH
    ON\\lib\\site-packages\\PIL',
    'C:\\APPS\\PYTHON\\lib\\site-packages\\win32', 'C:
    \\APPS\\PYTHON\\lib\\site-packages\\win32\\lib',
    'C:\\APPS\\PYTHON\\lib\\site-pa
    ckages\\Pythonwin',
    'C:\\APPS\\PYTHON\\lib\\site-packages\\wx-2.6-msw-ansi']

    C:\APPS\PYTHON>echo c:\apps\Python\MyModules > MyPaths.pth

    C:\APPS\PYTHON>type MyPaths.pth
    c:\apps\python\MyModules

    C:\APPS\PYTHON>python -c "import sys; print sys.path"
    ['', 'D:\\WINDOWS.0\\system32\\python24.zip', 'C:\\APPS\\PYTHON',
    'C:\\APPS\\PYT
    HON\\DLLs', 'C:\\APPS\\PYTHON\\lib', 'C:\\APPS\\PYTHON\\lib\\plat-win',
    'C:\\APP
    S\\PYTHON\\lib\\lib-tk', 'c:\\apps\\Python\\MyModules',
    'C:\\APPS\\PYTHON\\lib\\
    site-packages', 'C:\\APPS\\PYTHON\\lib\\site-packages\\PIL',
    'C:\\APPS\\PYTHON\\
    lib\\site-packages\\win32',
    'C:\\APPS\\PYTHON\\lib\\site-packages\\win32\\lib',
    'C:\\APPS\\PYTHON\\lib\\site-packages\\Pythonwin',
    'C:\\APPS\\PYTHON\\lib\\site-
    packages\\wx-2.6-msw-ansi']

    --
    Gabriel Genellina
    Gabriel Genellina, Feb 5, 2007
    #3
    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. Carlos Moreira

    PYTHONPATH x *.pth???

    Carlos Moreira, Sep 4, 2003, in forum: Python
    Replies:
    1
    Views:
    319
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Sep 4, 2003
  2. Carlos Moreira

    PYTHONPATH x *.pth???

    Carlos Moreira, Sep 4, 2003, in forum: Python
    Replies:
    0
    Views:
    285
    Carlos Moreira
    Sep 4, 2003
  3. Peter Maas

    .pth files in working directory

    Peter Maas, Aug 31, 2005, in forum: Python
    Replies:
    6
    Views:
    4,539
    Peter Maas
    Aug 31, 2005
  4. Replies:
    2
    Views:
    524
  5. pnm
    Replies:
    0
    Views:
    276
Loading...

Share This Page