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.


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.

7 Years
Discussion Span
Last Post by SoulMazer

Well, sorry for the double post, but I somehow solved my problem. I have no idea how...I just bugged around with some variable names and such and I stopped receiving the error. Weird.

Well, feel free to delete this thread. Sorry again.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.