[Tutor] (no subject)

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Thu, 25 Jul 2002 16:48:45 -0700 (PDT)


On Thu, 25 Jul 2002, Kyle Babich wrote:

> This is the error I get when I try to execute my script:
>
> [Thu Jul 25 18:09:24 2002] [error] [client 65.59.106.226] Premature end
> of script headers: /home/sites/sbn/www/public_html/index.py
> Traceback (most recent call last):
>   File "/home/sites/sbn/www/public_html/index.py", line 671, in ?
>     print """
> KeyError: content
> Traceback (most recent call last):
>   File "/home/sites/sbn/www/public_html/index.py", line 671, in ?
>     print """
> KeyError: content
> Traceback (most recent call last):
>   File "/home/sites/sbn/www/public_html/cgi-bin/index.py", line 671, in
>   ?
>     print """
> KeyError: content
>
> And all that displays in the browser is a blank page.
> I have attached the script.
>
> Can someone help me with this?  It seems like it is having a problem
> printing content but near the beginning I do have content = con.

Hi Kyle,


But it only assigns to content if an exception was raised:

###
try:
	con = form['con'].value
except KeyError:
    con = ""
    content = con

    ## [humongous except block omitted for clarity.]
###


If there were no KeyError, 'content' isn't assigned to.  From looking at
your code, I think you mean to take the rest of the except block and bring
it back to the left column: I think you want that block to execute,
regardless of the exception handling.



Hope this helps!