QUERY_STRING error

Joonas keisari_ at NOUSPAMMhotmail.com
Sun Oct 29 08:02:46 EST 2000


I got error seen below.

<snip>

Traceback (innermost last):
  File "./viestit.cgi", line 5, in ?
    komento = environ["QUERY_STRING"]
  File "/opt/python/lib/python1.5/UserDict.py", line 12, in __getitem__
    def __getitem__(self, key): return self.data[key]
KeyError: QUERY_STRING

</snip>


In script seen below.

<snip>

#!/opt/python/bin/python  

from string import *
from os import environ
q = environ["QUERY_STRING"]

tiedosto = open("msg.txt","r").read()
rivit = splitfields(tiedosto,"<!--msg-->")

print "Content-type: text/html\n\n";

print """<html>
<head>
<META HTTP-EQUIV=\"Expires\" CONTENT=\"Mon, 06 Jan 1990 00:00:01 GMT\">
<meta http-equiv=\"refresh\" content=\"100\">
<title>viestit</title>
<base target=\"_top\">
</head>
<body topmargin=\"0\">"""

if q == "fullscreen":
    print "<a href=\"http://www.host.xxx/~viirua/chat/\"
target=\"_top\">Palauta normaali näkymä.</a><br><br>"
else:
    print "<a href=\"viestit.cgi?fullscreen\" target=\"_top\">Avaa
viestit kokoru utuun.</a><br><br>"


for luku in range(1,50):
    print rivit[luku]

print """<br>
<br></body>
</html>""" 

</snip>


What could be wrong.

Joonas.



More information about the Python-list mailing list