Python+tkinter errors on OSX

John Chambers jcsd at speakeasy.net
Wed Jan 11 18:15:33 EST 2006


Sp my latest adventure is attempting to use python's Tkinter module on a few machines.
On my PB (OSX 10.3.9), I got the following confusing results:

/Users/jc: python
Python 2.3 (#1, Sep 13 2003, 00:49:11)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import Tkinter
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk/Tkinter.py", line 38, in ?
     import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
 >>> ^D
/Users/jc: ls -l /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk/*inter*
-rw-r--r--  1 root  wheel  154289 13 Sep  2003 /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk/Tkinter.py
-rw-r--r--  1 root  wheel  262073 13 Sep  2003 /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk/Tkinter.pyc
-rw-r--r--  1 root  wheel  262073 13 Sep  2003 /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk/Tkinter.pyo
/Users/jc:

So I'm trying to discover what's going wrong here, and how to fix it.
It does appear that Tkinter has been "installed", in some weak sense
of the term.  Under /System/Library/... there's a lib-tk directory, and
it contains some Tkinter.* files.  Furthermore, python's import command
clearly looked there and did something with the expected Tkinter.py
file.  But whatever it did was clearly not enough, because something
called "_tkinter" was expected but not found.

I also experimented with PATH and PYTHONPATH, to no apparent
effect on anything.

Anyone here know how to diagnose and/or fix this?  What's it trying
to tell me?  I have a feeling that it's there somewhere, but the proverbial
ducks aren't lined up quite right.

(Or maybe this isn't the right NG for such questions.  If so, what might
be a better one?)



More information about the Python-list mailing list