[Twisted-Python] struggling with twisted telnet

Jean-Paul Calderone exarkun at divmod.com
Wed Aug 8 07:49:41 MDT 2007


On Wed, 8 Aug 2007 14:27:36 +0100, Andrew Roden <andrew.roden at gmail.com> wrote:
>The answer is no I wasn't running it with twistd as I didn't need to with
>the ssh one... having now run it with twistd I can see the exceptions it
>throws but I have absolutely no clue how to go about rectifying them :(
>>From what I can make out the main issue is with no terminal size being set
>which from the demo_insults.tac looks like it's set in my class that deals
>with connections associating it with insults.TerminalProtocol (eg. class
>DemoProtocol(insults.TerminalProtocol): ) however, I am dealing with my
>connections in recvline as I don't want it to react on a per character basis
>but rather a per line basis...
>
>*confused of england*
>
>Andrew
>

The first traceback I see is this one:

2007-08-08 09:46:39-0400 [twisted.internet.protocol.ServerFactory] Unhandled Error
        Traceback (most recent call last):
          File "/home/exarkun/Projects/Twisted/trunk/twisted/python/log.py", line 36, in callWithContext
            return context.call({ILogContext: newCtx}, func, *args, **kw)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/python/context.py", line 59, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/python/context.py", line 37, in callWithContext
            return func(*args,**kw)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/selectreactor.py", line 139, in _doReadOrWrite
            why = getattr(selectable, method)()
        --- <exception caught here> ---
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/tcp.py", line 813, in doRead
            protocol.makeConnection(transport)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/protocol.py", line 333, in makeConnection
            self.connectionMade()
          File "/home/exarkun/Projects/Twisted/trunk/twisted/conch/telnet.py", line 732, in connectionMade
            self.protocol.makeConnection(self)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/protocol.py", line 333, in makeConnection
            self.connectionMade()
          File "/home/exarkun/Projects/Twisted/trunk/twisted/conch/telnet.py", line 795, in connectionMade
            self.protocol.makeConnection(self)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/protocol.py", line 333, in makeConnection
            self.connectionMade()
          File "/home/exarkun/Projects/Twisted/trunk/twisted/conch/insults/insults.py", line 416, in connectionMade
            self.terminalProtocol = self.protocolFactory(*self.protocolArgs, **self.protocolKwArgs)
        exceptions.TypeError: __init__() takes exactly 2 arguments (1 given)

Python is really helpful here, omitting the class name which has the bad
__init__, but I guess you can track that down with a little effort (and
there are probably only a small number of candidates).

The next one I see is this:

2007-08-08 09:46:39-0400 [TelnetTransport,0,127.0.0.1] Unhandled Error
        Traceback (most recent call last):
          File "/home/exarkun/Projects/Twisted/trunk/twisted/python/log.py", line 51, in callWithLogger
            return callWithContext({"system": lp}, func, *args, **kw)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/python/log.py", line 36, in callWithContext
            return context.call({ILogContext: newCtx}, func, *args, **kw)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/python/context.py", line 59, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/python/context.py", line 37, in callWithContext
            return func(*args,**kw)
        --- <exception caught here> ---
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/selectreactor.py", line 139, in _doReadOrWrite
            why = getattr(selectable, method)()
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/tcp.py", line 362, in doRead
            return self.protocol.dataReceived(data)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/conch/telnet.py", line 483, in dataReceived
            self.negotiate(commands)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/conch/telnet.py", line 526, in negotiate
            cmdFunc(bytes)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/conch/telnet.py", line 833, in telnet_NAWS
            self.protocol.terminalProtocol.terminalSize(width, height)
        exceptions.AttributeError: 'NoneType' object has no attribute 'terminalSize'

This may just be a consequence of the first one, so I'd try resolving the
first one before looking more at this.

Jean-Paul




More information about the Twisted-Python mailing list