By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,617 Members | 1,166 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,617 IT Pros & Developers. It's quick & easy.

Python+tkinter errors on OSX

P: n/a
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?)
Jan 11 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
John Chambers wrote:
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?)

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
Jan 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.