Module search path help, please.

Jive Dadson sfsdasdfa at isdfsdfa.invalid
Mon Dec 23 21:29:37 EST 2002


I've tried reading various documentation, but I'm coming up empty.  I
have a problem finding modules.  I'm running under Win32 (MS Windows
2000).

The problem I'm seeing right now cropped up when I installed
ActivePython (Python22).  Now I can't use the gnuplot module.  The
reason is that it cannot import module Numeric.

I reinstalled both Numeric, and gnuplot, using the provided install.exe
programs.  Both modules were installed in the site-packages directory. 
That did not help.

Here is the path I see when I type sys.path:

['', 'C:\\Python22\\Lib\\site-packages\\Pythonwin',
'C:\\Python22\\Lib\\site-packages\\win32',
'C:\\Python22\\Lib\\site-packages\\win32\\lib',
'C:\\Python22\\Lib\\site-packages', 'C:\\Python22\\DLLs',
'C:\\Python22\\lib', 'C:\\Python22\\lib\\lib-tk', 'C:\\Python22',
'C:\\Python22\\lib\\site-packages\\numarray']

Notice that it contains site-packages, but not site-packages/Numeric.  I
guess Python does not search sub-directories of site-packages. 
Correct?  (And why?)

So, my next idea was to augment the path with site-packages/Numeric.  I
fished around in the registry (shudder), but I did not find an entry
with the value of sys.path above.

Two questions...

1) How do I add something to the default search path that's used to find
modules?  I know I can modify it temporarily in a running Python
program, but that's not what I mean.  I think someone told me there's an
entry in the registry (shudder), but I can't recall where, and I can't
find it.

2) Is the there a way to make it search subdirectories of
lib/site-packages?

No more than three questions.

3) Is there some magic I can do with __init__.py?  What little
documentation I've found on that is rather sketchy.

Four questions is right out.

Jive



More information about the Python-list mailing list