Python+tkinter errors on OSX

J

John Chambers

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.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/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?)
 
K

Kevin Walzer

John said:
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.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/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?)
You probably don't have Tcl/Tk installed.

A package for 10.3 is available at http://tcltkaqua.sourceforge.net.

--
Cheers,

Kevin Walzer, PhD
WordTech Software - "Tame the Terminal"
http://www.wordtech-software.com
sw at wordtech-software.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top