Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ftp callback
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.storbinary('STOR mydata.txt', open('mydata.txt', 'rb'), callback=UploadTracker())

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 .
Larz60+ wrote Sep-13-2018, 10:57 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)