[Tutor] urllib.urlretrieve ?

Matthew Ngaha chigga101 at gmail.com
Sun Apr 7 17:07:52 CEST 2013


Im following a tutorial on what i believe is using Python 2 and i'm a
bit confused. I use Python 3 on windows vista. I believe
urlretrieve() is a python 2 function that isnt in 3, but why is the
tutorial using urllib instead of urllib2? Also when i run the program
on Python 3, it says:

AttributeError: 'module' object has no attribute 'urlretrieve'

so Python 3 doesnt recognize this function, i want to ask if there is
an equivalent function to 'urlretrieve' in Python 3? the program uses
this function to download a file as so:

urllib.urlretrieve(self._url, self._filename, reporthook)

the 3rd argument is a function that is called to track progress of the
current download status. i dont really need help with the program, i
understand its code, but i need to know if this function has one
similar in Python 3? or do you have any examples of how i could add
its functionality to Python 3.


More information about the Tutor mailing list