[Pythonmac-SIG] pythonw vs. python

Ronald Oussoren ronaldoussoren at mac.com
Mon Feb 20 18:56:59 CET 2006


I've been thinking a little about pythonw vs. python. The former is  
needed because on OSX any API that needs a connection to the window  
server (anything that uses a native GUI and some other calls) need to  
be in an application bundle. pythonw is a program that can be placed  
anywhere on the PATH and exec's a normal python interpreter inside an  
application bundle.

As of yesterday the python24-fat tree[1] will install a copy of  
pythonw as the normal python interpreter, that is both 'python' and  
'pythonw' are the same program, the one that execs an interpreter  
inside an application bundle. This works, but at the cost of  
additional call to exec and therefore two application startups. I  
guess the additional cost should be lost in the noise, but the micro- 
optimizer in me isn't happy and especially so because everybody pays  
while almost nobody should need this feature.

The common workaround for this is the undocumented function  
'CPSEnableForegroundOperation'. Another workaround might be the  
TransformProcessType API introduced in OSX 10.3.  Would it be  
worthwhile to look into these, or is it better to worry about other  
things instead.

Ronald

[1]: http://svn.pythonmac.org/python24/python24-fat



More information about the Pythonmac-SIG mailing list