curl-and-python

progress callback

From: Juan Manuel Ruiz Garcia <jruiz_at_efe.es>
Date: Wed, 08 Sep 2010 12:38:16 +0000

Hi,

I had a script using callback to get progress of uploading a file to a
ftp server.

The option was set like this:

txFTP = pycurl.Curl()
txFTP.setopt(txFTP.PROGRESSFUNCTION, progress)

The callback function is this one:

def progress(download_t, download_d, upload_t, upload_d):
     print "Total to download", download_t
     print "Total downloaded", download_d
     print "Total to upload", upload_t
     print "Total uploaded", upload_d

This works perfectly when executed in
     Python 2.5/ and 'libcurl/7.15.5 OpenSSL/0.9.8 zlib/1.2.3
c-ares/1.7.1 libssh2/1.3.1',
but when I've tried to port it to
     Python 2.6, 'libcurl/7.20.1 OpenSSL/1.0.0 zlib/1.2.5 c-ares/1.7.1
libssh2/1.2.5'
download_t, download_d, upload_t, upload_d are always set to value=0.

Is this a bug? Anyone has any idea to solve it?

Thanks in advance,

Juan Manuel
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2010-09-08