Problem using urllib to download images
drobinow at gmail.com
drobinow at gmail.com
Mon Nov 3 12:13:38 EST 2008
On Nov 3, 11:48 am, tstro... at googlemail.com wrote:
> I am using Python 2.6 on Mac OS 10.3.9.
> I have been trying to use:
> image = urllib.URLopener()
> image.retrieve(url, filename)
> to download images from websites. I am able to do so, and end up with
> the appropriate file. However, when I try to open the file, I get an
> error message. It's something about corrupted data, and an
> unrecognised file.
> Anyone know what I'm talking about/had similar experiences?
> -Taidgh
Please show an actual program, complete with error messages.
import urllib
image = urllib.URLopener()
image.retrieve("http://www.python.org/images/success/nasa.jpg",
"NASA.jpg")
Works for me.
More information about the Python-list
mailing list