[Tutor] getting image from url

Amit Sethi amit.pureenergy at gmail.com
Fri Jul 10 17:29:50 CEST 2009


Hi , I am trying to get  images from url

Their is  a  mail relating to it here :
"http://mail.python.org/pipermail/python-list/2001-October/108548.html"

but when i followed similar procedure :

>>> import urllib
>>>fp = urllib.urlopen("http://en.wikipedia.org/wiki/File:Portrait_john_calvin.jpg")
>>>img = cStringIO.StringIO(fp.read())
>>> Image.open(img)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1917, in open
    raise IOError("cannot identify image file")
IOError: cannot identify image file

what is wrong?? how can I rectify...



-- 
A-M-I-T S|S


More information about the Tutor mailing list