P
Python_it
I going to use the cgi-handler (mod_python):
http://www.modpython.org/live/mod_python-3.2.2b/doc-html/hand-cgi.html
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.FieldStorage()
#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: "PythonHandler mod_python.cgihandler"
Traceback (most recent call last):
File "C:\Program
Files\Python24\Lib\site-packages\mod_python\apache.py", line 299, in
HandlerDispatch
result = object(req)
File "C:\Program
Files\Python24\Lib\site-packages\mod_python\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\clickpie.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?
http://www.modpython.org/live/mod_python-3.2.2b/doc-html/hand-cgi.html
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.FieldStorage()
#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: "PythonHandler mod_python.cgihandler"
Traceback (most recent call last):
File "C:\Program
Files\Python24\Lib\site-packages\mod_python\apache.py", line 299, in
HandlerDispatch
result = object(req)
File "C:\Program
Files\Python24\Lib\site-packages\mod_python\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\clickpie.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?