[Tutor] "Internal Server Error"

Ignacio Vazquez-Abrams ignacio@openservices.net
Sun, 9 Sep 2001 13:25:48 -0400 (EDT)


On Sun, 9 Sep 2001, Jon Cosby wrote:

> Can somebody tell me why this works:
>
> x = dict.items()
> x.sort(paircomp)
> for k, v in x:
> 	k = string.replace(k, dir + '/', url)
> 	k1 = string.replace(k, url, "")
> 	print '<a href=\"' + k + '\">'
> 	print '<b>', k1, '</b></a>&nbsp;', v, counter(v), 'matches<br>'
> print '</body>'
>
>
> But when I modify it slightly,
>
>
> if len(dict) = 0:
              ^^^

> 	print '<h3>No matches found</h3>'
> else:
> 	x = dict.items()
> 	x.sort(paircomp)
> 	for k, v in x:
> 		k = string.replace(k, dir + '/', url)
> 		k1 = string.replace(k, url, "")
> 		print '<a href=\"' + k + '\">'
> 		print '<b>', k1, '</b></a>&nbsp;', v, counter(v), 'matches<br>'
> print '</body>'
>
>
> I get an "internal server error"?

If you try running it manually, you'll get a SyntaxError exception.

-- 
Ignacio Vazquez-Abrams  <ignacio@openservices.net>