Richard Holmes <richa...@dslextreme.com> writes: > 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
This is a classic problem known as “namespace clobbering”. It is best to *avoid* the recommendations made in many libraries of ‘from foo import *’, because that will clobber any names in your namespace that happen to match names in the ‘foo’ module. Rather, import Tkinter and PIL as distinct namespaces:: >>> import PIL.Image >>> import Tkinter as tk >>> tk.Image <class Tkinter.Image at 0xf6d7f3c0> >>> PIL.Image <module 'PIL.Image' from >>> '/usr/lib/python2.6/dist-packages/PIL/Image.pyc'> and then you know that none of the names from those modules will clobber existing ones. -- \ “Those who write software only for pay should go hurt some | `\ other field.” —Erik Naggum, in _gnu.misc.discuss_ | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list