[IPython-user] IPython/wxPython crash on ppc Mac OS X 10.4.8

Michael Scarpa m.scarpa at uva.nl
Thu Nov 23 03:56:10 CST 2006


On 21 Nov, 2006, at 17:33, Jouni K Seppanen wrote:

> Michael Scarpa <m.scarpa at uva.nl> writes:
>
>> The question here would be, how to detect whether one is using  
>> Python/
>> readline from Apple or their own, but I guess you guys know more
>> about that than I do.  Just being curious here.
>
> Since the problem is so far only known to exist on the MacPython
> version, how about something like this:
>
> if sys.executable == '/Library/Frameworks/Python.framework/ 
> Versions/' + \
>                      '2.4/Resources/Python.app/Contents/MacOS/ 
> Python' and \
>    sys.version_info == (2, 4, 3, 'final', 0):
>     print "You may experience problems with readline."
>
> In Apple's version, sys.executable is '/usr/bin/python', and I suppose
> it will be '/sw/bin/python' and '/opt/local/bin/python' in Fink and
> Macports.

sys.executable is "/usr/bin/python" or similar only when you use the  
"python" executable.  On the Mac, there is also a script called  
"pythonw" which is needed for applications that access the window  
manager (exception made for X11).  This script actually calls the  
executable of a Mac-style application bundle, because otherwise Mac  
OS X refuses to grant it access to the window manager and its  
events.  The bottom line is, that when using "pythonw",  
sys.executable will always be something like ".../Library/Frameworks/ 
Python.framework/...".  If one installs Python through MacPorts, if I  
recall correctly, it puts the framework in /Library/Frameworks (I  
customized my installation, so I can't tell for sure).  In this case  
the sys.executable and sys.version_info would be pretty much what  
Jouni proposed in his snippet, so I'm afraid it won't be that easy.   
Am I wrong?

With kind regards,

Michael



More information about the IPython-user mailing list