[Pythonmac-SIG] Why Do I Explicitly Need MacPython

Dave Reed davelist at mac.com
Wed Sep 27 01:52:27 CEST 2006


On Sep 26, 2006, at 4:51 PM, Bob Ippolito wrote:

> On 9/26/06, Dave Reed <davelist at mac.com> wrote:
>>
>> On Sep 25, 2006, at 6:31 PM, Russell E Owen wrote:
>>
>> > At 5:26 PM -0400 2006-09-25, davelist at mac.com wrote:
>> >> I'm very interested in this and would be happy to help with
>> >> testing. I teach Python at the college level using John Zelle's
>> >> Python book (it uses Tk for simple GUI programs). Most of the
>> >> programs run fine, but some of the more complex ones crash
>> >> intermittently within Tk. The same program seems to run fine on
>> >> Windows using 2.4.3 although it does crash intermittently on
>> >> CentOS 4.3 within Tk.
>> >>
>> >> In the meantime, are you saying the simplest solution for my
>> >> students with Macs is to use ActiveState (some have G4 laptops and
>> >> some have Intel based laptops)?
>> >>
>> >> I have a G5 running 10.3.9 at work (IT isn't planning to upgrade
>> >> yet) and a G5 running 10.4.x at home so I'll be happy to test on
>> >> both of those.
>> >
>> > If it's bugs in Tcl/Tk that are causing the crashes then by all
>> > means I would try:
>> > - Install ActiveState Tcl/Tk 8.4.11 or 8.4.13.
>> > - Install MacPython (it's better than the one from Apple, plus
>> > you're about to modify python, and you shouldn't modify anything
>> > in /System)
>> > - Modify _tkinter.so according to Bob Ippolito's recipe. At the
>> > command line:
>> >
>> > install_name_tool \
>> >      -change /System/Library/Frameworks/Tcl.framework/Versions/8.4/
>> > Tcl \
>> >              /Library/Frameworks/Tcl.framework/Versions/8.4/Tcl \
>> >      -change /System/Library/Frameworks/Tk.framework/Versions/ 
>> 8.4/Tk \
>> >              /Library/Frameworks/Tk.framework/Versions/8.4/Tk \
>> > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
>> lib-
>> > dynload/_tkinter.so
>> >
>> > The above command should be six lines long; you'll probably have to
>> > unwrap at least the last line.
>> >
>> > An alternative is to install ActiveState Python instead of
>> > MacPython, because it works with ActiveState Tcl/Tk "out of the
>> > box". But it doesn't include readline. You can add readline, but I
>> > think it's easier to fix _tkinter.so.
>> >
>> > -- Russell
>>
>>
>> I installed ActiveState Tcl and MacPython 2.4.3 on the 10.3.9
>> machine. The /Systems/Library/Frameworks/Tk.framework directory does
>> not exist (the Tcl.Framework directory does so I tried the above
>> install_name_tool line with just the Tcl lines (and the final line
>> with ._tkinter.so).
>>
>> I can't get some Tk programs to run now. Using the graphics.py  
>> file at:
>> http://mcsp.wartburg.edu/zelle/python/graphics.py
>>
>> I get:
>>
>>
>> $ /usr/local/bin/python
>> Python 2.4.3 (#1, Apr  7 2006, 10:54:33)
>> [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
>> Type "help", "copyright", "credits" or "license" for more  
>> information.
>>  >>> import graphics
>>  >>> Tk_MacOSXSetupTkNotifier: first [load] of TkAqua has to occur in
>> the main thread!
>> Abort trap
>>
>> Does anyone still have a 10.3.9 system to try importing that
>> graphics.py file and see if it works for them? Any thoughts on making
>> it work? I have an old python 2.3.5 from fink that does import
>> graphics.py ok and works fine for many simple programs but crashes on
>> more complicated programs.
>>
>> I have not yet tried it on the 10.4.7 G5 yet.
>
> From that warning, it appears that the way graphics.py uses threads is
> not compatible with TkAqua. It either needs to be refactored to do its
> graphics stuff in the main thread, or you need to use an X11 Tk.
>
> -bob

Thanks Bob and Ronald.

There's an alternate version of the graphics.py file (graphics22.py)  
here:

http://mcsp.wartburg.edu/zelle/python/

that says it is non-threaded, but I thought I tried it at work on the  
10.3.9 system and got the same error (I'll double check tomorrow). I  
believe the separate thread was used because it caused fewer problems  
with idle on Windows, but I'll have to check with John Zelle to be  
certain.

Dave




More information about the Pythonmac-SIG mailing list