What's wrong with my script?

Sheila King sheila at spamcop.net
Fri Sep 14 23:30:37 CEST 2001


On Fri, 14 Sep 2001 23:51:10 +0400 (MSD), Roman Suzi <rnd at onego.ru>
wrote in comp.lang.python in article
<mailman.1000497276.20930.python-list at python.org>:

:May be it is better to put it all into triple-quotes?
:
:print """Content-type: text/html
:
:<html><head>
:<title>Aramedis.com</title>
:<meta http-equiv="refresh" content="5;URL=http://www.aramedis.de/de/index.htx">
:</head>
:<body bgcolor=#000000>
:hallo
:</body>
:</html>"""

Because of the meta-tag contents, you are probably right. The way he had
it before, he was unquoting in the middle of his tag:

print "<meta http-equiv="refresh" content="5;
URL=http://www.aramedis.de/de/index.htx">"


As others have suggested, looking at the messages in the error log would
also be especially helpful.

Or, try this:


   #!/usr/local/bin/python
   import cgi
   import sys        # include this
   import traceback  # include this

   sys.stderr = sys.stdout
   print "Content-Type: text/html\n"

   try:

     print """

<html><head>
<title>Aramedis.com</title>
<meta http-equiv="refresh"
content="5;URL=http://www.aramedis.de/de/index.htx">
</head>
<body bgcolor=#000000>
hallo
</body>
</html>"""

   except:  # trap Python error and display in browser

       print "\n\n<PRE>"
       traceback.print_exc()
       print "\n</PRE>"


This way, the error messages will display in your browser.

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/




More information about the Python-list mailing list