[Twisted-Python] FTP Client - questions
andrew at bemusement.org
Thu Mar 18 18:52:30 EDT 2010
Renan Mathias Fernandes wrote:
> 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
You are incorrect. FTPClient.retrieveFile returns a Deferred that fires
when the download is complete (or reports a failure).
The API doc hints at this, but could be clearer.
> print "Exception -", sys.exc_value
> Can anyone shed a light?
A direct correction to this snippet is:
d = ftpClient.retrieveFile('testFile.txt', test)
print "Exception -", failure.getErrorMessage()
(Although like your code will only stop the reactor when an error
occurs, and doesn't do anything when the download completes
More information about the Twisted-Python