[Twisted-Python] “Unhandled Error” comes when TCP server tries to accept connections from client in twisted

Laurens Van Houtven _ at lvh.io
Fri Jun 28 15:12:10 MDT 2013


You forgot to set the protocol attribute of the factory.

factory.protocol = ChatServer
On Jun 28, 2013 10:05 PM, "jaspreet singh Kalsi" <
jaspreetsingh4575 at gmail.com> wrote:

> from twisted.internet.protocol import Factory,Protocolfrom twisted.internet import reactor
> class ChatServer(Protocol):
>     def connectionMade(self):
>     print "A Client Has Connected"
>
> factory = Factory()
> reactor.listenTCP(80,factory)print "Chat Server Started"
>
> reactor.run()
>
>
>
> the above code is running succesfully.but when I try to open TCP(telnet localhost 80).
>
>
> Errors occurs :
>
> Unhandled ErrorTraceback (most recent call last):
>   File "C:\Python27\lib\site-packages\twisted\python\log.py", line 69, in callWithContext
>     return context.call({ILogContext: newCtx}, func, *args, **kw)
>   File "C:\Python27\lib\site-packages\twisted\python\context.py", line 118, in callWithContext
>     return self.currentContext().callWithContext(ctx, func, *args, **kw)
>   File "C:\Python27\lib\site-packages\twisted\python\context.py", line 81, in callWithContext
>     return func(*args,**kw)
>   File "C:\Python27\lib\site-packages\twisted\internet\selectreactor.py", line 150, in _doReadOrWrite
>     why = getattr(selectable, method)()--- <exception caught here> ---
>   File "C:\Python27\lib\site-packages\twisted\internet\tcp.py", line 718, in doRead
>     protocol = self.factory.buildProtocol(self._buildAddr(addr))
>   File "C:\Python27\lib\site-packages\twisted\internet\protocol.py", line 104, in buildProtocol
>     p = self.protocol()
> exceptions.TypeError: 'NoneType' object is not callable
>
>
>
> I m using windows 8,python 2.7 and Twisted 12.0
>
> sir/mam i have also discuss this question on stackoverflow ...but i did'nt get any appropriate answer.....
>
>
> please help me .
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20130628/0a6b5064/attachment-0002.html>


More information about the Twisted-Python mailing list