Good day, everyone:<br><br>Continuing my effort to learn Python and Twisted, I need to create several Telnet clients and somehow send two arguments to each and receive data from each.<br><br>I tried the same pattern that I used with the Telnet server and created a Factory, actually a ReconnectingClientFactory.  It doesn&#39;t work.  My source and the error (no attribute &#39;factory&#39;) are below.<br>
<br>Do the &quot;conch&quot; protocols not support a factory?  Is there an alternative that provides a Telnet client with a lineReceived method?<br><br>What am I doing wrong?  :-)  I suppose I could pass arguments to ClusterClient by overriding __init__, but that seems inelegant.<br>
<br>Thanks for your help.<br><br>Mark<br><br>----------<br><br>from twisted.internet.protocol import Protocol, ReconnectingClientFactory<br>from sys import stdout<br><br>from twisted.internet import reactor<br><br>from twisted.conch.telnet import StatefulTelnetProtocol<br>
<br>class ClusterClient(StatefulTelnetProtocol):<br><br>    def lineReceived(self, data):<br>        print self.factory.prompt, self.factory.call<br>        print data<br><br>class ClusterClientFactory(ReconnectingClientFactory):<br>
<br>    protocol = ClusterClient<br><br>    def __init__(self):<br>        self.prompt = &quot;call:&quot;<br>        self.call = &quot;kd4d&quot;<br><br>    def startedConnecting(self, connector):<br>        print &#39;Started to connect.&#39;<br>
<br>    def buildProtocol(self, addr):<br>        print &#39;Connected.&#39;<br>        self.resetDelay()<br>        return ClusterClient()<br><br>    def clientConnectionLost(self, connector, reason):<br>        print &#39;Lost connection.  Reason:&#39;, reason<br>
        ReconnectingClientFactory.clientConnectionLost(self, connector, reason)<br><br>    def clientConnectionFailed(self, connector, reason):<br>        print &#39;Connection failed. Reason:&#39;, reason<br>        ReconnectingClientFactory.clientConnectionFailed(self, connector,<br>
                                                         reason)<br>if __name__ == &#39;__main__&#39;:<br>    factory = ClusterClientFactory()<br>    factory.maxDelay = 120  #  two minutes<br>    print factory.prompt, factory.call<br>
    reactor.connectTCP(&quot;localhost&quot;, 8023, factory)<br><br><br>    reactor.run()<br><br>-----------------<br><br>  File &quot;ClusterClient.py&quot;, line 11, in lineReceived<br>    print self.factory.prompt, self.factory.call<br>
exceptions.AttributeError: ClusterClient instance has no attribute &#39;factory&#39;<br>Lost connection.  Reason: [Failure instance: Traceback (failure with no frames):<br> &lt;type &#39;exceptions.AttributeError&#39;&gt;: ClusterClient instance has no attribute &#39;fa<br>
ctory&#39;<br>]<br><br>