Progress indicator during FTP upload

Christophe Delord no.spam
Sun Jan 4 22:10:12 CET 2004

On Sun, 04 Jan 2004 19:31:34 +0100, Frantisek Fuka wrote:

> My application uses ftplib to upload files to remote server. What is
> the cleanest way to provide progress indicator for long files? What
> exactly should I override in the ftplib (I am not very proficient in
> the FTP protocol)?


To update my web site I wrote a script in wich I have overriden
ftplib.FTP to print a dot when a block of bytes is sent. Here is my
dot_FTP class :

class dot_FTP(ftplib.FTP):
    def storbinary(self, cmd, fp, blocksize=8192):
        ''' Store a file in binary mode.'''
        self.voidcmd('TYPE I')
        conn = self.transfercmd(cmd)
        while 1:
            buf =
            if not buf: break
        return self.voidresp()

I just took the code of storbinary in and added the wanted


More information about the Python-list mailing list