image from URL

Oleg Broytmann phd at phd.pp.ru
Thu Oct 11 06:58:41 EDT 2001


On Thu, Oct 11, 2001 at 05:46:01AM -0500, Randy Heiland wrote:
> >>> import urllib, Image
> >>> fp = urllib.urlopen("http://www.python.org/pics/PyBanner027.gif")
> >>> im = Image.open(fp)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/home/heiland/PythonMod/Imaging-1.1.2/PIL/Image.py", line 944,
> in open
>     fp.seek(0)
> AttributeError: addinfourl instance has no attribute 'seek'

im = Image.open(fp.read())
   fp is not a file name, it is already file (file-like object, to be
precise).

Oleg.
---- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.




More information about the Python-list mailing list