Finding modules in subdirectories of sys.path
Maan M. Hamze
mmhamze at pleiades.net
Wed Aug 22 17:17:10 EDT 2001
Norm
I have not used these packages and I do not know how they install. But from
my experience in Windows - if you install packages, you should be able to
use modules by importing packages. so if you have these directories in
sys.path, did you try:
import Physics
for example and see what happens? Provided you have __init__.py in that
subdirectory it should find it. Then you can use modules from this package.
Maan
"Norm Wood" <norm at wombat.atmos.colostate.edu> wrote in message
news:3b841921 at news.ColoState.EDU...
> Hi,
>
> I've installed the NumPy extensions and Scientific Python package into
> subdirectories of my home directory:
>
> /home/me/lib/python2.0/Numeric
> /home/me/lib/python2.0/Scientific
>
>
> The Scientific directory contains a number of subdirectories (Physics,
> Statistics, etc.). It appears that, in order to import modules from
> these subdirectories, each subdirectory has to be listed explicitly
> in sys.path. Otherwise, I get an import error.
>
> Is it possible to cause python to search recursively through the
> directories rooted at /home/me/lib/python2.0? Or is it possible
> to place some sort of index in /home/me/lib/python2.0 so that python
> can locate the modules within the subdirectories without explicitly
> listing each subdirectory in sys.path?
>
> Thanks,
>
> Norm Wood
>
> --
> Norm Wood
>
> Department of Atmospheric Science
> Colorado State University
> norm at atmos.colostate.edu
> phone: 970-491-3334
More information about the Python-list
mailing list