I going to use the cgi-handler (mod_python):
If I test a simply py script it works
code:
===========
print "Content-type: text/html\n"
print """
<html>
<body>
<h1>TEST</h1>
</body>
</html>
"""
============
But if I test a py script with cgi comments (import cgi):
Part of the code
============
import cgi
#get HTTP query parameters
query = cgi.FieldStorag e()
#Get the selected year and month
selectedYear = int(query["year"].value)
selectedMonth = int(query["x"].value) + 1
#Get the monthly revenue
monthlyRevenue = float(query["value"].value)
============
I get the following error:
errormessage:
=============== ===========
Mod_python error: "PythonHand ler mod_python.cgih andler"
Traceback (most recent call last):
File "C:\Program
Files\Python24\ Lib\site-packages\mod_py thon\apache.py" , line 299, in
HandlerDispatch
result = object(req)
File "C:\Program
Files\Python24\ Lib\site-packages\mod_py thon\cgihandler .py", line 96, in
handler
imp.load_module (module_name, fd, path, desc)
File "C:/Program Files/Apache
Group/Apache2/htdocs/clue/modules/templates\click pie.py", line 9, in ?
selectedYear = int(query["year"].value)
File "C:\Program Files\Python24\ Lib\cgi.py", line 559, in __getitem__
raise KeyError, key
KeyError: 'year'
Who can help me?
If I test a simply py script it works
code:
===========
print "Content-type: text/html\n"
print """
<html>
<body>
<h1>TEST</h1>
</body>
</html>
"""
============
But if I test a py script with cgi comments (import cgi):
Part of the code
============
import cgi
#get HTTP query parameters
query = cgi.FieldStorag e()
#Get the selected year and month
selectedYear = int(query["year"].value)
selectedMonth = int(query["x"].value) + 1
#Get the monthly revenue
monthlyRevenue = float(query["value"].value)
============
I get the following error:
errormessage:
=============== ===========
Mod_python error: "PythonHand ler mod_python.cgih andler"
Traceback (most recent call last):
File "C:\Program
Files\Python24\ Lib\site-packages\mod_py thon\apache.py" , line 299, in
HandlerDispatch
result = object(req)
File "C:\Program
Files\Python24\ Lib\site-packages\mod_py thon\cgihandler .py", line 96, in
handler
imp.load_module (module_name, fd, path, desc)
File "C:/Program Files/Apache
Group/Apache2/htdocs/clue/modules/templates\click pie.py", line 9, in ?
selectedYear = int(query["year"].value)
File "C:\Program Files\Python24\ Lib\cgi.py", line 559, in __getitem__
raise KeyError, key
KeyError: 'year'
Who can help me?
Comment