[mod_python] Unable to import modules in subdirs

Graham Dumpleton grahamd at dscpl.com.au
Fri Oct 28 18:10:20 EDT 2005


On 29/10/2005, at 1:39 AM, Jorey Bump wrote:
>> I have Vampire up and running, though from a doc it specifies "...The 
>> mechanism will also not work where a module is actually a package. 
>> Any application specific modules should therefore not be structured 
>> as packages..." which I imagine is a restriction coming from 
>> mod_python. I have existing code that is already structured in 
>> various packages and I'd like to keep it that way.
>
> This is handler-specific. Graham doesn't like packages. :)

I use packages all the time and have no problem with how you use them.
My only problem with them is that it is practically impossible to
implement an automatic reloading mechanism that will work for a package.
If you make use of your packages using "import" your code should always
work. If you are using apache.import_module() to import the root of a
package or a sub part of it presently, then you are probably lucky that
it works reliably now, but if they want to fix module reloading in
mod_python properly, don't expect any form of module reloading to work
on packages in the future. This doesn't mean you wouldn't be able to
specify a package using apache.import_module(), it would just fall
through to using standard Python __import__ for a package and nothing
is going to reload from a package if you change it on disk.

Graham



More information about the Mod_python mailing list