[mod_python] how in include custom module in psp ?

Graham Dumpleton graham.dumpleton at gmail.com
Sun Jan 20 01:22:14 EST 2008


Do not call your module 'test' as there is a standard Python module of
the same name and you may be picking that up instead of your own.

Also possible you are being affected by:

  http://issues.apache.org/jira/browse/MODPYTHON-220

Graham

On 20/01/2008, James Yu <cyu021 at gmail.com> wrote:
> I just finished working on a skeleton of a web site.
> Now I would like to put the codes in common into some functions.
> I tried to put the function in a .py file and included the file in <%%>
> block, but this doesn't work.
>
> This is the example of how I did it (both test.py and web.psp are in the
> same folder):
> test.py:
> def hello_world():
>     return 'hello world'
>
> web.psp:
> <%
> import test
>
> a = test.hello_world ()
> %>
>
> This turned out showing me the following msg:
> AttributeError: 'module' object has no attribute 'hello_world'
>
> Someone please gives me a hand on importing custom modules in mod_python
> PSP.
> --
> This is a UTF-8 formatted mail
> -----------------------------------------------
> James C.-C.Yu
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>


More information about the Mod_python mailing list