creating my own module search path

Sean 'Shaleh' Perry shaleh at valinux.com
Mon Feb 26 05:39:19 CET 2001


so, like a good little coder I use functions for code reusability and ease of
maintenance.  I have a directory structure like:

./
  frontend/
  lib/
  ...

I would like to be able to load files in lib as python modules.  I know how
to add the directory to sys.path.  The problem is I have a module named
'util.py'.  Sure, I could rename it.  But I can not possibly know the name of
every module on a user's system.  What I was trying to do was add the path
just before lib to the search path and load it as 'lib.util'.  But this does not
work.  Suggestions anyone?




More information about the Python-list mailing list