Loading modules from several directories

Eugene Pervago eugene at ulka.com
Wed Sep 18 18:38:55 EDT 2002


"Steve Holden" <sholden at holdenweb.com> wrote in message news:<6Q1i9.1149$bh1.989 at fe03>...
> "Eugene Pervago" <eugene at ulka.com> wrote ...
> 
> [...]
> > If I put the project_a path first, it loads its modules but can't
> > import the /onedir/foo modules. It seems package can only be in one
> > place, once Python finds it, it just stops looking elsewhere.
> >
> 
> What would you rather have it do? Load them both? Find every possible
> package and load the oine with the most recent modification date/time? Load
> the longest one? Load the one whose checksum is closest to your birthdate?

They do not intersect. Actually the structure is something like this:
/onedir/foo
   dbutils.py
   utils.py
   auth.py

/anotherdir/foo - Nothing
/anotherdir/foo/projectA
    User.py
    Product.py

In Unix I would do it using symlinks, not possible on Windows. I can
think of two solutions:
 
1) Copy /onedir/foo/*.py to anotherdir/foo/ for each project 
   (Doesn't seem like a good solution, though easily doable since the
common
    files are under version control)
2) Instead of foo.projectA have a foo_projectA or fprojectA to avoid
problems
   with nested packages.

Neither of those two is particularly attractive to me. Any
suggestions?

Thanks,
Eugene Pervago



More information about the Python-list mailing list