question about python

fishfin calebjhansen at gmail.com
Sat Sep 13 12:12:48 CEST 2008


On Sep 13, 4:25 pm, Carl Banks <pavlovevide... at gmail.com> wrote:
> On Sep 13, 1:00 am, fishfin <calebjhan... at gmail.com> wrote:
>
> > @ Carl: Yes, I think your right now that I look at it (or at least all
> > except for the last two lines need to be indented). I'm still not sure
> > how to send the stuff to the web browser though. Thanks for pointing
> > it out!
>
> Try reading in the whole HTTP request instead of just the first line.
> Change
>
> line = cfile.readline().strip()
>
> to
>
> line = cfile.read()
>
> And see if that helps.  (Outputting the document so that it formats
> the request well is left as an exercise.  Also, as a heads up: in real
> programs you should never output anything you receive through the
> network without checking it or escaping it to prevent malicious uses.)
>
> Carl Banks

I figured out what the problem was. When you had suggested that I
indent the lines at first I did all of them, but when I did that there
must have been an nonindented line before the last two lines which I
had indented, so ending the 'while 1:'. Because of that, that code
just flat out didn't work so I assumed that they must be not be
indented which is why it hasn't been working all along. Thanks for
your help! I don't think I would have every figured it out if you last
post hadn't gotten me to thinking about little tweeks like that.



More information about the Python-list mailing list