[mod_python] The new module loader

Dan Eloff dan.eloff at gmail.com
Fri Apr 21 16:35:24 EDT 2006


Hey Graham,

I'm running into one problem related to taking things out of the
packages. I've imported PyServer.module_name in many places in my
modules but of course now PyServer no longer exists and all it's
modules are in the directory with pyserver.py which contains the
handler. I changed import PyServer.config to just import config, but
it doesn't find it.

I'm loathe to use absolute or even relative paths because of how many
different places I'd have to modify it. Is there some way to globally
add the handler's directory to the search path?

Thanks,
-Dan

On 4/21/06, Dan Eloff <dan.eloff at gmail.com> wrote:
> Whoops. I was looking over the code for import_module and I figured it
> out. path is meant to be a list, duh. Maybe add an
>
> assert not path or isinstance(path, list), 'path must be a list of
> paths to search for the module.'
>
> to your code near the top of the function. Otherwise if path is a
> string, search_path.extend(path) doesn't throw, but it makes a huge
> search_path of single character locations and fails utterly (and
> silently)
>
> -Dan
>



More information about the Mod_python mailing list