.pth configuration method not working

M

Mark

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
 
J

John Machin

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
 
G

Gabriel Genellina

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']
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top