Sep-13-2018, 02:39 PM
Hello,
I want to use a callback when upload of a file to ftp . Here is my code:
from ftplib import FTP
def UploadTracker():
print "HELLO"
myftp = FTP()
myftp.connect(host='mysite.com')
myftp.login('me','mypw')
myftp.storbinary('STOR mydata.txt', open('mydata.txt', 'rb'), callback=UploadTracker())
myftp.quit()
Upload of mydata.txt works ok , but the result shows only one "HELLO" at start of upload ...
mydata.txt weigth is 1800ko . So I was waiting for many many HELLO message , each time a block of 8192 bytes is uploaded , but it does'nt works. Did I make a error ?
I have tried different ways of writing this code (with global variables to follow upload, etc ...) but no differences, only one callback to UploadTracker is made . What is my error ?
Many thanks for your help .
Roberto
I want to use a callback when upload of a file to ftp . Here is my code:
from ftplib import FTP
def UploadTracker():
print "HELLO"
myftp = FTP()
myftp.connect(host='mysite.com')
myftp.login('me','mypw')
myftp.storbinary('STOR mydata.txt', open('mydata.txt', 'rb'), callback=UploadTracker())
myftp.quit()
Upload of mydata.txt works ok , but the result shows only one "HELLO" at start of upload ...
mydata.txt weigth is 1800ko . So I was waiting for many many HELLO message , each time a block of 8192 bytes is uploaded , but it does'nt works. Did I make a error ?
I have tried different ways of writing this code (with global variables to follow upload, etc ...) but no differences, only one callback to UploadTracker is made . What is my error ?
Many thanks for your help .
Roberto