Problem using urllib to download images

tstrogen at googlemail.com tstrogen at googlemail.com
Mon Nov 3 13:21:13 EST 2008


Then perhaps it's a problem with my os.
[TERMINAL SESSION]
[18:16:33 Mon Nov 03] python
Python 2.6 (trunk:66714:66715M, Oct  1 2008, 18:36:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> url = 'http://www.google.com/webhp?hl=en'
>>> filename = 'logo.gif'
>>> image = urllib.URLopener()
>>> image.retrieve(url, filename)
('logo.gif', <httplib.HTTPMessage instance at 0x5196e8>)
[/TERMINAL SESSION]
And here's the error message I get when I try to open it: "File Error:
Couldn't open the file. It may be corrupt or a file format that
Preview doesn't recognize.".
I have had a similar result trying  to open it with other programs.
-Taidgh



More information about the Python-list mailing list