[mod_python] When I try to use include directive an SyntaxError error occurs

Jim Gallacher jpg at jgassociates.ca
Mon Apr 10 10:38:29 EDT 2006


Андрей Долин wrote:
> Salut, everybody.
> 
> When I try to use include directive an SyntaxError error occurs.
> For example:
> 
> Mod_python error: "PythonHandler index::index"
> 
> Traceback (most recent call last):
> 
>   File "/usr/local/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
>     result = object(req)
> 
>   File "/home/mik/proj/python/pysite01/htdocs/index.py", line 8, in index
>     template = psp.PSP(req, filename)
> 
>   File "/usr/local/lib/python2.4/site-packages/mod_python/psp.py", line 111, in __init__
>     self.load_from_file()
> 
>   File "/usr/local/lib/python2.4/site-packages/mod_python/psp.py", line 179, in load_from_file
>     code = compile(source, filename, "exec")
> 
>   File "/home/mik/proj/python/pysite01/htdocs/tst3.psp", line 8
> 
>     req.write("""
> """,0); include file="tst4.psp";req.write("""
> 
>                  
>                    ^
> 
> SyntaxError: invalid syntax
> 
> 
> index.py content:
> 
> #
> # there's some stuff here that the handler doesn't actually use....
> 
> from mod_python import apache, psp, util, Cookie, Session
> 
> def index(req):
>     filename = "tst3.psp"
>     template = psp.PSP(req, filename)
>     return apache.OK
> 
> 
> tst3.psp content:
> 
> <html>
> <%
> import time
> %>
> Hello world, the time is: <%=time.strftime("%Y-%m-%d, %H:%M:%S")%><br>
> <%
> %>
> <% include file="tst4.psp"%>

Missing '@' perhaps?

<%@ include file="tst4.psp"%>
^^^

Jim



More information about the Mod_python mailing list