[Distutils] module_path, recursive scanning for (.pth) files does not work

fredaa elder fdjcomp at yahoo.com
Mon Jul 31 10:39:36 CEST 2006


Hi

I have a problem (possible bug?) with the search path
setup:

version python 2.4.3
located in c:\python

I want to have my modules in a completely separate
dir:
f:\dev\python\lib

i made a test module
f:\dev\python\lib\math\test_module.py


now i have a test file in 
f:\dev\python\lib\test\test_001.py
which needs to load test_module.py

manual text:
Installing Python Modules /Greg Ward
Python Software Foundation 
Email: distutils-sig at python.org 
Release 2.4.3
29 March 2006

says:

The most convenient way is to add a path configuration
file to a directory that's already on Python's path,
usually to the .../site-packages/ directory. Path
configuration files have an extension of .pth, and
each line must contain a single path that will be
appended to sys.path. (Because the new paths are
appended to sys.path, modules in the added directories
will not override standard modules. This means you
can't use this mechanism for installing fixed versions
of standard modules.) 

Paths can be absolute or relative, in which case
they're relative to the directory containing the .pth
file. Any directories added to the search path will be
scanned in turn for .pth files

So: I put a file "lib.pth" in ../site-packages/
If I put the full path (f:\dev\python\lib\math) to
test_module in this file, it works
and test_001.py can load the test_module

Now for the problem
If i put only (f:\dev\python\lib) in lib.pth
and I put a file math.pth in this path with a relative
dir (math)
sys.path will only have (f:\dev\python\lib) added to
it
and test_001.py cannot load the test_module

conclusion:
the "Any directories added to the search path will be
scanned in turn for .pth files"
does not work


any suggestions?
what did i do wrong?

hope you can point me the way

and thanks for a great language


Frederik AA de Jonge









__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Distutils-SIG mailing list