PIL Open Problem

Richard Holmes richardh at dslextreme.com
Mon Feb 7 17:27:06 EST 2011


I'm trying to create an image for use in Tkinter. If I understand the
PIL documentation correctly, I first need to import Image, then
create an instance of the Image class and call 'open' (this according
to the documentation). When I try to do this using the model in the
documentation, I get:

Traceback (most recent call last):
  File "todo.py", line 202, in <module>
    im = Image.open(cwd + r'\delete.GIF', 'r')
AttributeError: class Image has no attribute 'open'

where 'cwd' is the current working directory obtained using the os
module. When I import Image into IDLE and enter help(Image.open), IDLE
is quite happy to give me the info about the function.

Can someone point out to me the folly of my ways?

TIA!

Dick Holmes



More information about the Python-list mailing list