Life cycle of a mod_python application and scope of global variables
p-abel at t-online.de
Sat Jan 25 14:39:00 CET 2003
Kyle Yancey <lakeofburningfire at kyle.orgdon'tspamme> wrote in message news:<50f33vofevm3og4bp1ji85atd22bqduv11 at 4ax.com>...
> Okay. Now I feel silly. It doesn't seem to work. I tested the
> following script, and I got an error.
> #!/usr/bin/env python
> from mod_python import apache
> i = 1
> def handler(req):
# insert here
# and it will work
> req.content_type = "text/html"
> if i:
> req.write("Hello World!")
> i = 0
> return apache.OK
> The error was local variable referenced before assignment.
> The faq says that this should display the behavior I described.
> I hope I haven't wasted anyones time. Apologies if I made a mistake.
> This is my first usenet post.
More information about the Python-list