[Tutor] getting image from url

Emile van Sebille emile at fenx.com
Fri Jul 10 17:49:04 CEST 2009


On 7/10/2009 8:29 AM Amit Sethi said...
> 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())

Right here, try...

     img.read()[:50]

... and it should become clear what the problem is...

HTH,

Emile



More information about the Tutor mailing list