PIL Open Problem

Ben Finney ben+python at benfinney.id.au
Mon Feb 7 23:47:32 CET 2011

Richard Holmes <richardh at dslextreme.com> writes:

> 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:

Please show the code you used that generated this traceback.

> 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'

The line of code shown in the traceback is calling the ‘open’ method on
the ‘Image’ class – which has no such method, as the error tells you.

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

It will be much easier when we see some code. Post a minimal, working
example that still shows the behaviour you want explained.

 \       “If you make people think they're thinking, they'll love you; |
  `\     but if you really make them think, they'll hate you.” —Donald |
_o__)                                             Robert Perry Marquis |
Ben Finney

More information about the Python-list mailing list