[Pythonmac-SIG] Python 2.2.2 and Tkinter installation problems on OS X

Nicholas Riley njriley@uiuc.edu
Tue, 26 Nov 2002 13:39:31 -0600


Hi,

I just tried following the Python installation instructions here:

<http://www.astro.washington.edu/owen/InstallingPythonOnJaguar.html>

I had many problems, some of which I was able to overcome.

- I needed to use the CVS Tcl/Tk build instructions the page linked to
instead of yours.  The Tcl and Tk source directories needed to be
renamed 'tcl' and 'tk' in order for the installation process to work
correctly, otherwise it dies while building HTML documentation.

- There are 'chmod's in the project file script which expects the
Apple-supplied chmod instead of the GNU chmod I had in my path; it
should be changed to '/bin/chmod' in the project.pbxproj files.

- After fixing the above, I still couldn't get a functional Tcl/Tk
installation:

[p3:5147] ~/src%tclsh
application-specific initialization failed: Can't find a usable init.tcl in the following directories:
    @TCL_IN_FRAMEWORK@ /usr/lib/tcl8.4 /lib/tcl8.4 /usr/library
    /library /tcl8.4a5/library @TCL_IN_FRAMEWORK@

I found this problem documented:

<http://www.geocrawler.com/archives/3/7933/2002/7/0/9107415/>

I didn't understand the proposed resolutions in that mailing list
thread, so I gave up on the source and installed TclTkAqua 8.4.1
binary distribution from here:

<http://prdownloads.sourceforge.net/tcl/TclTkAqua-8.4.1.dmg?download>

This is a really nicely put-together installer which worked in about 5
seconds (modulo prebinding :) and seems to include everything I need.

The remainder of the installation went as described, but the 'python'
and 'pythonw' programs were both broken in different ways with respect
to module loading and Tk.

If I run python.exe directly from the build tree, Tk works, except for
the window activation problems:

[p6:5153] ~/src/Python-2.2.2%./python.exe
Python 2.2.2 (#6, Nov 26 2002, 12:39:08)
[GCC 3.1 20020105 (experimental)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from Tkinter import *
>>> x = Tk()
>>> RCNE SendEventToEventTarget (Caml 1                   ) failed, -128
[a window appears]

But running python from the framework doesn't work:

[p6:5154] ~/src/Python-2.2.2%python
in sitecustomize.py
Python 2.2.2 (#6, Nov 26 2002, 12:39:08)
[GCC 3.1 20020105 (experimental)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from Tkinter import *
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/Library/Frameworks/Python.framework/Versions/2.2/lib/python2.2/lib-tk/Tkinter.py", line 35, in ?
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter

And pythonw gives me even stranger messages:

[p6:5155] ~/src/Python-2.2.2%pythonw
original argc=1
original argv[0] = "/Applications/Python.app/Contents/MacOS/python"
modified argc=1
modified argv[0] = "/Applications/Python.app/Contents/MacOS/python"
Python 2.2.2 (#6, Nov 26 2002, 12:39:08)
[GCC 3.1 20020105 (experimental)] on darwin
Type "copyright", "credits" or "license" for more information.
in sitecustomize.py
>>> from Tkinter import *
LookupError: no codec search functions registered: can't find encoding
>>> x = Tk()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'Tk' is not defined
>>> import sys
>>> sys.path
['', '/Library/Frameworks/Python.framework/Versions/2.2/lib/python2.2', '/Library/Frameworks/Python.framework/Versions/2.2/lib/python2.2/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.2/lib/python2.2/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.2/lib/python2.2/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.2/lib/python2.2/site-packages', '/Library/Frameworks/Python.framework/Versions/2.2/Mac/Lib']

Everything looks to be OK with the path; any ideas as to what is
wrong?

Thanks,

-- 
=Nicholas Riley <njriley@uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>
        Pablo Research Group, Department of Computer Science and
  Medical Scholars Program, University of Illinois at Urbana-Champaign