Python+tkinter errors on OSX

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Chambers

    #1

    Python+tkinter errors on OSX

    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.[color=blue][color=green][color=darkred]
    >>> import Tkinter[/color][/color][/color]
    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "/System/Library/Frameworks/Python.framewor k/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[color=blue][color=green][color=darkred]
    >>> ^D[/color][/color][/color]
    /Users/jc: ls -l /System/Library/Frameworks/Python.framewor k/Versions/2.3/lib/python2.3/lib-tk/*inter*
    -rw-r--r-- 1 root wheel 154289 13 Sep 2003 /System/Library/Frameworks/Python.framewor k/Versions/2.3/lib/python2.3/lib-tk/Tkinter.py
    -rw-r--r-- 1 root wheel 262073 13 Sep 2003 /System/Library/Frameworks/Python.framewor k/Versions/2.3/lib/python2.3/lib-tk/Tkinter.pyc
    -rw-r--r-- 1 root wheel 262073 13 Sep 2003 /System/Library/Frameworks/Python.framewor k/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?)
  • Kevin Walzer

    #2
    Re: Python+tkinter errors on OSX

    John Chambers wrote:[color=blue]
    > 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.[color=green][color=darkred]
    >>>> import Tkinter[/color][/color]
    > Traceback (most recent call last):
    > File "<stdin>", line 1, in ?
    > File
    > "/System/Library/Frameworks/Python.framewor k/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[color=green][color=darkred]
    >>>> ^D[/color][/color]
    > /Users/jc: ls -l
    > /System/Library/Frameworks/Python.framewor k/Versions/2.3/lib/python2.3/lib-tk/*inter*
    >
    > -rw-r--r-- 1 root wheel 154289 13 Sep 2003
    > /System/Library/Frameworks/Python.framewor k/Versions/2.3/lib/python2.3/lib-tk/Tkinter.py
    >
    > -rw-r--r-- 1 root wheel 262073 13 Sep 2003
    > /System/Library/Frameworks/Python.framewor k/Versions/2.3/lib/python2.3/lib-tk/Tkinter.pyc
    >
    > -rw-r--r-- 1 root wheel 262073 13 Sep 2003
    > /System/Library/Frameworks/Python.framewor k/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?)[/color]
    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"

    sw at wordtech-software.com

    Comment

    Working...