why this server can not run in python30
davy zhang
davyzhang at gmail.com
Wed Oct 22 06:23:30 EDT 2008
thanks so much for fixing the problems!!
On Wed, Oct 22, 2008 at 2:56 PM, Gabriel Genellina
<gagsl-py2 at yahoo.com.ar> wrote:
> En Wed, 22 Oct 2008 03:45:31 -0200, davy zhang <davyzhang at gmail.com>
> escribió:
>
>> import asyncore, asynchat
>> import os, socket, string
>>
>> PORT = 8000
>>
>> class HTTPChannel(asynchat.async_chat):
>>
>> def __init__(self, server, sock, addr):
>> asynchat.async_chat.__init__(self, sock)
>> self.set_terminator("\r\n")
>
> self.set_terminator(b"\r\n")
>
>> self.request = None
>> self.data = ""
>
> self.data = b""
>
> Same for all remaining string literals, should be bytes instead.
>
>> self.request = string.split(self.data, None, 2)
>
> The string module functions are deprecated ages ago in favor of the
> corresponding string (instance) methods:
>
> self.request = self.data.split(None, 2)
>
> That's enough - the example worked fine for me after doing these changes.
>
> --
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list