Hello,

        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):
        self.file.write(data)
                
def connectionMade(ftpClient):
    test = FileReceiver('./testRetrieve.txt')
    
    try:
        ftpClient.retrieveFile('testFile.txt',test)
    except:
        print "Exception -", sys.exc_value
        reactor.stop()


Can anyone shed a light?

Thanks in advance,

Renan Mathias Fernandes





_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to