Thanks
--
Frantisek Fuka
(yes, that IS my real name)
(and it's pronounced "Fran-tjee-shek Foo-kah")
----------------------------------------------------
My E-mail: fu...@fuxoft.cz
My Homepage: http://www.fuxoft.cz
My ICQ: 2745855
> 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)?
>
Hello,
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 = fp.read(blocksize)
if not buf: break
conn.send(buf)
sys.stdout.write('.')
sys.stdout.flush()
conn.close()
return self.voidresp()
I just took the code of storbinary in ftplib.py and added the wanted
output.
Christophe.
> 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)?
>>
>
> Hello,
>
> 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 :
Slick. Thank you.
Dave
[snip]
--
Never forget the halloween documents.
http://www.opensource.org/halloween/
""" Where will Microsoft try to drag you today?
Do you really want to go there?"""