[Twisted-Python] Invalid 'reason' info

Sorin C. soso_pub at yahoo.com
Wed May 19 16:17:25 EDT 2004


Hi, 

If a reactor.connectTCP() is issued and the reactor is
stopped before connecting the following is the
'reason' send to clientConnectionFailed(self,
connector, reason):

reason.type = twisted.internet.error.ConnectError

reaseon.getErrorMessage() = An error occurred while
connecting: [Failure instance: Traceback:
twisted.internet.error.ConnectionLost, Connection to
the other side was lost in a non-clean fashion:
Connection lost.

The type is ok but the error message is not. It says
ConnectionLost which is wrong, from both information
and class type. 

Here is a quick testcode:

"""
from twisted.internet import reactor
from twisted.internet.protocol import ClientFactory

class Factory(ClientFactory):
    
    def clientConnectionFailed(self, connector,
reason):
        print 'clientConnectionFailed:',
str(reason.type), reason.getErrorMessage()
    
class Main:

    def start(self):
        
        reactor.connectTCP('localhost', 2175,
Factory())
        reactor.stop()
        reactor.run()
    
        
if __name__ == '__main__':
    Main().start()

"""

Side note: 2175 port is closed here si it is not
suppose to connect anyway.

Regards,
Sorin



	
		
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/




More information about the Twisted-Python mailing list