[Twisted-Python] FTP Client - questions

Renan Mathias Fernandes renan at renanfernandes.org
Thu Mar 18 12:01:20 EDT 2010


	I am trying to learn/implement a FTP Client, but I am facing a problem: How can I check if the retrieveFile method has finished downloading a file? As far as I can see, there is no easy way to do this, am I incorrect?
Below is an example of what I am doing to retrieve a file:

class FileReceiver(Protocol):
        Protocol subclass that writes received data to a local file.
    def __init__(self, filename):
        self.file = open(filename, 'wb')

    def dataReceived(self, data):
def connectionMade(ftpClient):
    test = FileReceiver('./testRetrieve.txt')
        print "Exception -", sys.exc_value

Can anyone shed a light?

Thanks in advance,

Renan Mathias Fernandes

More information about the Twisted-Python mailing list