problems with libtk 8.5

skip at pobox.com skip at pobox.com
Tue Jan 29 17:02:04 PST 2008


I installed the py25-tkinter port which got me tk 8.5.  Unfortunately, when
I run a program which uses it I get an exception from Python
(/opt/local/bin/python2.5 in this case):

    Traceback (most recent call last):
      File "/Users/skip/src/leo-4.4.6-final/src/leoPlugins.py", line 222, in loadOnePlugin
        init_result = result.init()
      File "/Users/skip/src/leo-4.4.6-final/plugins/plugins_menu.py", line 212, in init
        g.app.createTkGui(__file__)
      File "/Users/skip/src/leo-4.4.6-final/src/leoApp.py", line 254, in createTkGui
        g.app.root = g.app.gui.createRootWindow()
      File "/Users/skip/src/leo-4.4.6-final/src/leoTkinterGui.py", line 89, in createRootWindow
        self.root = root = Tk.Tk()
      File "/opt/local/lib/python2.5/lib-tk/Tkinter.py", line 1638, in __init__
        self._loadtk()
      File "/opt/local/lib/python2.5/lib-tk/Tkinter.py", line 1658, in _loadtk
        % (_tkinter.TK_VERSION, tk_version)
    RuntimeError: tk.h version (8.5) doesn't match libtk.a version (8.4)

Poking around my system I found tk 8.4 in /usr/lib and
/System/Library/Frameworks/Tkc.framework:

If I run Python interactively I can import Tkinter:

    % /opt/local/bin/python2.5
    Python 2.5.1 (r251:54863, Jan  1 2008, 13:29:09) 
    [GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    Traceback (most recent call last):
      File "/Users/skip/.python.py", line 21, in <module>
        from save_session import mark, save, load
      File "/Users/skip/misc/python/save_session.py", line 21, in <module>
        raise ImportError("session save/restore requires readline module")
    ImportError: session save/restore requires readline module
    >>> import Tkinter
    >>> import _tkinter
    >>> _tkinter.__file__
    '/opt/local/lib/python2.5/site-packages/_tkinter.so'

and that version of _tkinter.so is in fact not linked to the MacPorts
version:

    % otool -L /opt/local/lib/python2.5/site-packages/_tkinter.so
    /opt/local/lib/python2.5/site-packages/_tkinter.so:
            /System/Library/Frameworks/Tcl.framework/Versions/8.4/Tcl (compatibility version 8.4.0, current version 8.4.0)
            /System/Library/Frameworks/Tk.framework/Versions/8.4/Tk (compatibility version 8.4.0, current version 8.4.0)
            /usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version 93.0.0)
            /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.10)

Have I somehow muffed something?

Thanks,

-- 
Skip Montanaro - skip at pobox.com - http://www.webfast.com/~skip/

The major difference between Democrats and Republicans is that
Republicans don't know that Randy Newman's lyrics are full of sarcasm.


More information about the macports-users mailing list