ftplib storbinary method interception
Peter Schneider-Kamp
petersc at stud.ntnu.no
Sat Jun 3 19:36:18 EDT 2000
Bablos wrote:
>
> Please don't tell me I'm going to have to rewrite chunks of ftplib.py
> - I'm well and truly a beginner with Python...
just define your own version of storbinary
in your module:
def mystorbinary(self, cmd, fp, blocksize):
'''Store a file in binary mode and print stuff.'''
self.voidcmd('TYPE I')
conn = self.transfercmd(cmd)
counter = 0
while 1:
print counter,"Bytes read yet."
buf = fp.read(blocksize)
if not buf: break
conn.send(buf)
conn.close()
return self.voidresp()
just-pass-your-FTP-object-as-the-first-parameter-ly y'rs
Peter
--
Peter Schneider-Kamp ++47-7388-7331
Herman Krags veg 51-11 mailto:peter at schneider-kamp.de
N-7050 Trondheim http://schneider-kamp.de
More information about the Python-list
mailing list