[Python-Dev] urlretrieve regression no.2, now in Python 3.3

Terry Reedy tjreedy at udel.edu
Wed Nov 7 23:42:58 CET 2012

On 11/7/2012 5:57 AM, anatoly techtonik wrote:
> urlretrieve has a callback parameter, which takes function with the
> following prototype:
>    def callback(block_number, block_size, total_size):
>      pass
> Where block_size was constant and block_size*block_number gave an exact
> number of transferred bytes.

The 3.2 and 3.3 docs both say "The third argument, if present, is a hook 
function that will be called once on establishment of the network 
connection and once after each block read thereafter. The hook will be 
passed three arguments; a count of blocks transferred so far, a block 
size in bytes, and the total size of the file. The third argument may be 
-1 on older FTP servers which do not return a file size in response to a 
retrieval request."

The word 'constant' does not appear. The product is still the same.

> Recent change in Python 3.3 changed the semantic of block_size and broke
> my `wget` package. http://bugs.python.org/issue16409

The only change is that blocksize is now reported as 0 before any blocks 
have been transmitted. It is a side-effect of commits for

Terry Jan Reedy

More information about the Python-Dev mailing list