[Pythonmac-SIG] Python 2.7b2 framework install

Ronald Oussoren ronaldoussoren at mac.com
Tue Jun 1 13:25:14 CEST 2010


On 1 Jun, 2010, at 12:35, Michiel de Hoon wrote:

> I tried this again on Mac OS X 10.5 and found that the Python inside Python.app works as a framework, but python and pythonw do not:
> 
> $ /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python 
> Python 2.7b2+ (trunk:81635, Jun  1 2010, 20:39:42) 
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import MacOS
>>>> MacOS.WMAvailable()
> True
>>>> ^D
> 
> 
> $ which python
> /Library/Frameworks/Python.framework/Versions/2.7/bin//python
> 
> $ python
> Python 2.7b2+ (trunk:81635, Jun  1 2010, 20:39:42) 
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import MacOS
>>>> MacOS.WMAvailable()
> False
>>>> ^D
> 
> $ ls -l /usr/local/bin/python
> lrwxr-xr-x  1 root  wheel  60 Jun  1 20:42 /usr/local/bin/python -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python
> 
> $ /usr/local/bin/python
> Python 2.7b2+ (trunk:81635, Jun  1 2010, 20:39:42) 
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import MacOS
>>>> MacOS.WMAvailable()
> False
>>>> ^D
> 
> If I move python2.7 from /Library/Frameworks/Python.framework/Versions/2.7/bin to /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python, then I can run python2.7 as a framework.
> 
> So I guess what is happening is that because of the use of posix_spawn in pythonw in Python 2.7, the executable is in /Library/Frameworks/Python.framework/Versions/2.7/bin, instead of inside Python.app, so it doesn't interact appropriately with the window manager. Python 2.6 uses execve in pythonw, so /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python is the executable, and behaves as a framework.

For both 2.6 and 2.7 the pythonw and python executables in bin execute Python.app/Contents/MacOS/Python, the latter is the real executable. The only difference between 2.6 and 2.7 is how the executable inside Python.app is started: 2.6 uses execv() to start the real executable while 2.7 uses posix_spawn (when available, it falls back to execv on older versions of OSX).

What happens when you install Python using the beta installer at python.org? Does that behave in the same way as the version you installed yourself? 

I'm currently running 10.6, I'll try to find some time to test in a 10.5 VM later this week.   Could you please file an issue in the python bugtracker to ensure that this issue doesn't get lost?

Ronald


> 
> --Michiel.
> 
> --- On Sun, 5/30/10, Ronald Oussoren <ronaldoussoren at mac.com> wrote:
> 
>> From: Ronald Oussoren <ronaldoussoren at mac.com>
>> Subject: Re: [Pythonmac-SIG] Python 2.7b2 framework install
>> To: "Michiel de Hoon" <mjldehoon at yahoo.com>
>> Cc: pythonmac-sig at python.org
>> Date: Sunday, May 30, 2010, 11:59 AM
>> 
>> On 30 May, 2010, at 4:00, Michiel de Hoon wrote:
>> 
>>> Hi everybody,
>>> 
>>> When I try to install Python as a framework:
>>> 
>>> ./configure --enable-framework
>>> make
>>> make install
>>> 
>>> then Python gets installed under
>> /Library/Frameworks/Python.framework/Versions/2.7, but it
>> doesn't seem to function as a framework:
>>> 
>>>>>> import MacOS
>>>>>> MacOS.WMAvailable()
>>> False
>> 
>> Odd. This works for me using a universal build.
>> 
>> 
>>>>>> 
>>> 
>>> Python 2.6.5 installed as a framework returns True
>> here.
>>> 
>>> With Python 2.7b2, my extension module (the MacOSX
>> backend for matplotlib) doesn't interact correctly with the
>> window manager; it works fine with Python 2.6.5.
>>> 
>>> Did anything change in the installation of frameworks
>> between Python 2.6.5 and 2.7b2?
>> 
>> The python/pythonw command's got replaced by a slightly
>> more useful implementation. 
>> 
>> Which version of OSX are you on?
>> 
>> Ronald
>>> 
>>> Thanks,
>>> --Michiel.
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
>> 
>> 
> 
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3567 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20100601/b403441f/attachment.bin>


More information about the Pythonmac-SIG mailing list