PIL Open Problem

rantingrick rantingrick at gmail.com
Mon Feb 7 18:54:15 EST 2011


On Feb 7, 5:35 pm, Richard Holmes <richa... at dslextreme.com> wrote:

> Thanks, Ben. It turns out that I imported both Image and Tkinter and
> Tkinter has an Image class that masked the Image class in the Image
> module. I solved the problem by moving the Image code to a separate
> module

Yes an another great example of why "from Tkinter import *" is a very
*very* bad idea. Use "import Tkinter as tk" to solve the dilemma. No
need to export code to another module. Next time you have an object
that should have an attribute but does not, print the repr() of the
object to find out what you are working with before clawing your
eyeballs out in frustration :).


>>> from Tkinter import *
>>> Image
<class Tkinter.Image at 0x027429C0>


use the repr() function in a script ... print repr(Image)



More information about the Python-list mailing list