Graham Dumpleton writes: > And that is what the documentation I pointed you at states: > > """Note that with the new module importer, as directories associated > with Python*Handler directives are no longer being added automatically > to sys.path and they are instead used directly by the module importer > only when required, some existing code which expected to be able to > import modules in the handler root directory from a module in a > subdirectory may no longer work. In these situations it will be > necessary to set the mod_python module importer path to include '~' or > list '~' in the __mp_path__ attribute of the module performing the > import."""
OK, I think it's slowly sinking in...when I put the ~ in, it didn't affect sys.path, so my import still wasn't going to work. Right? So, how the heck do I import the modules? Do I have to use apache.import_module() now? But I don't want to! > If one wants to be precise, the addition of the handler directory to > sys.path was actually done by the top level mod_python dispatch code > rather than the module importer itself. And this I don't understand at all. If this "feature" was in the old system, why would reimplementing an api function change this behaviour in the dispatch code? I would consider this a bug. I would also say this is WAY too much functionality change for a minor release update. > The other important bit is: > > """As a new feature in mod_python 3.3, when using the standard Python > 'import' statement to import a module, if the import is being done > from a module which was previously imported by the mod_python module > importer, it is equivalent to having called apache.import_module() > directly.""" > > It is because of this that the directory doesn't need to be in > sys.path, as under the covers, when 'import' is being used by modules > imported by the mod_python module importer directly in some way, then > 'import' is equivalent to having used 'apache.import_module()' and > therefore it looks in places related to mod_python including stuff in > the separate mod_python importer path. And I would call this a bug, too. Why should using mod_python change the behaviour of the import builtin? What if I'm including a package that includes a package that includes a package? I'd have no idea what code is doing the work. This is getting way too obfuscated for my simple ways. Dan