Trying to understand how it works ftplib.
I am trying to save a file on an FTP server and implement a callback.
The documentation says:
FTP.storbinary(command, file[, blocksize, callback, rest])
Functioncallback defined as in the documentation:
A callback function is called for each block of received data, with a single-line argument giving the data block.
How to implement this callback? The callback in retrbinary(reading the file) might look like this:
def handle(block):
f.write(block)
print ".",
The file download progress will be displayed, fis a file object.
But I do not understand how to implement this with storbinary.
Any suggestions on how to do this? I know about a parameter block, but how do I configure it at boot time?
UPDATE:
I have a callback to load:
def handle(block):
f.read(block)
print ".",
, , :
an integer is required
int(block) .