Loading modules from several directories
Steve Holden
sholden at holdenweb.com
Wed Sep 18 19:21:43 EDT 2002
"Eugene Pervago" <eugene at ulka.com> wrote ...
> "Steve Holden" <sholden at holdenweb.com> wrote ...
> > "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?
>
I'm at something of a loss to understand why both directories have to be
called foo and what the relationship is between them. Why not foo1 and foo2?
Am I missing something?
regards
-----------------------------------------------------------------------
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/
Previous .sig file retired to www.homeforoldsigs.com
-----------------------------------------------------------------------
More information about the Python-list
mailing list