[Twisted-Python] bug in conch tutorial

Paul Boehm typo at soniq.net
Sun Aug 24 21:15:12 EDT 2003

class CatChannel(channel.SSHChannel):
    name = 'session'
    def channelOpen(self, data):
        d = self.conn.sendRequest(self, 'exec', common.NS('cat'),
                                  wantReply = 1)
        self.catData = ''

imho self.catData should be cleared before it's possible for the
deferred to fire, and append to catData.

    def _cbSendRequest(self, ignored):
        self.write('This data will be echoed back to us by "cat."\r\n')
    def dataReceived(self, data):
        self.catData += data
    def closed(self):
        print 'We got this from "cat":', self.catData

More information about the Twisted-Python mailing list