PIL Open Problem

Westley Martínez anikom15 at gmail.com
Mon Feb 7 19:10:31 EST 2011

On Mon, 2011-02-07 at 15:54 -0800, rantingrick wrote:

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

Or just print(Image). print() automatically calls str() on an object.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110207/750de09e/attachment.html>

More information about the Python-list mailing list