[Twisted-Python] Correct way to handle errors of connectTCP
![](https://secure.gravatar.com/avatar/c4c8b1f74e1124bac9349772a7085ffc.jpg?s=120&d=mm&r=g)
March 31, 2008
6:59 p.m.
Hi, I expected reactor.connectTCP to return a deferred. That would have been nice, since callbacks would have handled the outcome. So how to I handle failure with it? I tried: from twisted.internet.error import ConnectionRefusedError print "Connecting..." try: reactor.connectTCP(self.server, self.port, self.f) except ConnectionRefusedError(reason): self.Connect_Failure() return self.Connect_Success() No good. What am I missing? Thank you! Simon -- Linux user #458601 - http://counter.li.org.
6164
Age (days ago)
6165
Last active (days ago)
2 comments
2 participants
participants (2)
-
Jean-Paul Calderone
-
Simon Pickles