[Twisted-Python] attribute error when I am trying to make one factory to send data to another

Louis D. Burr ldanielburr at me.com
Tue Apr 28 10:33:25 MDT 2015


Hi Jessica,

> On Apr 28, 2015, at 10:14 AM, Jessica Tsui <jesadjust at gmail.com> wrote:
SNIP
>  exceptions.AttributeError: MultiEcho instance has no attribute ‘factory'
SNIP
> MultiEcho().dataReceived(sendermessage)
Here you create an instance of the protocol directly, i.e., without having instantiated a MutilEchoFactory.  The factory’s buildProtocol method is what assigns the factory instance as a member of the protocol (self.factory), and since you didn’t create the protocol via a factory, you have no factory attribute on your protocol instance.

There are a number of ways to fix this, but generally speaking, you need to provide a way for your factories and their protocols to be aware of each other.

Hope this helps,

Daniel
--
L. Daniel Burr
ldanielburr at me.com
(312) 656-8387

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20150428/d6a87573/attachment-0002.html>


More information about the Twisted-Python mailing list