[mod_python] reload() change to import_module()

Graham Dumpleton graham.dumpleton at gmail.com
Mon Jul 21 19:55:41 EDT 2008


2008/7/22 David Angulo Junk <DavidAnguloJunk at gmail.com>:
> In this setup: Apache/2.2.9 (Unix) mod_python/3.3.1 Python/2.3.4
> I have code that does this:
>
> ---- start code snippet ----
> from mod_python import apache
>
>
> def handler(req):
>
>     apache.import_module('my_module')
> ---- start code snippet ----
>
>
> And I'm getting this error:
>
>     AttributeError: 'module' object has no attribute 'input_module'
>
>
> Any idea what might be wrong?

Where is my_module?

If my_module in same directory, in mod_python 3.3.1 you can still say just:

  import my_module

as it does some magic to map to apache.import_module(), provided it is
actually a candidate for reloading.

If still using apache.import_module() directly, you have to assign
result to a name and reference through name.

  my_module = apache.import_module('my_module')

  my_module.input_module

You don't show all the code, so can't see how you are trying to
reference the loaded module.

Graham


More information about the Mod_python mailing list