Hi All,

I made a python ftp client on Windows XP which does binary get & put.

The issue here is that when I do FTP manually the time taken to either GET or PUT is about half the time taken by my ftp client.

Following is a snippet of my code; Is there a better approach to do this?

def get(self,filename):
            start = time.clock() 
            self.ftph.retrbinary('RETR '+ filename, open(filename, 'wb').write)
            end = time.clock() 
        except Exception:
            print "Error in downloading the remote file."
            print "Successful download!"
            print "GET completed in %f seconds." % (end-start)


I'm not positive about this but I would assume that some of the time is consumed in the buffering of the file write process.

Perhaps in stead of an open file handle you could try an IOString, which after the operation is complete you could write to file in one chunk?

Hi Jim,

I was looking around for IOString module. But I could'nt find it, import IOString fails on windows.


Lo siento mi amigo, it's StringIO... sometimes I type faster than my brain can process words. :\