This is python:
#!/usr/bin/python
def a():
a = 'test'
return a
a = a()
print a
it works fine. the output is:
test
now let's try this via WSGI:
def a():
return 'test'
def application(environ, start_response):
a = a()
start_response('200 OK', [('Content-Type', 'text/html')])
yield a
the error is:
UnboundLocalError: local variable 'a' referenced before assignment
the only way to fix this error is to rename the variable "a" to something else such as..
a1 = a()
now there is no longer and error in WSGI.
but why is this ?