Hi, so I am trying to write a simple chat server in Python. If I just run the server, it runs fine. Yet, when I try to connect to the server from a different terminal via a "telnet localhost (port)", the server gives me an error:
error: uncaptured python exception, closing channel <__main__.ChatServer listening :5008 at 0x7f7eb733be60> (<type 'exceptions.TypeError'>:__init__() takes exactly 3 arguments (2 given) [/usr/lib/python2.6/asyncore.py|read|74] [/usr/lib/python2.6/asyncore.py|handle_read_event|408] [./ChatServer.py|handle_accept|58])
warning: unhandled close event
I saw the "__main__.ChatServer" and the "TypeError'>__init__() takes exactly 3 arguments (2 given)", so I assumed I was forgetting to pass a variable...yet I don't think I am.
Code:
port = 5008
name = "TestChat"
class ChatServer(dispatcher):
def __init__(self, port, name):
...
...
s = ChatServer(port, name)
try: asyncore.loop()
So...what's my problem here? It complains about receiving 2 variables instead of 3...but it only accepts 2 (port, name)? Now what can I do to solve my problem?
Thanks in advance.