[Pythonmac-SIG] Mac OSX pythonw python and Tk...

Bob Ippolito bob@redivi.com
Thu, 18 Jul 2002 13:53:57 -0400


try:
/usr/local/bin/python

The argv[0] is actually (seemingly) vitally important to the 
WindowServer, an argv[0] with a relative or shell-completed path is not 
going to make it happy.  Far as I know it needs to be set properly *as 
soon as you link* to Carbon or Cocoa.  There's a way to molest it into 
working even if that's not the case, but it's nasty and uses some 
undocumented (and not listed in the headers) CoreGraphics calls.  
There's also a way to rewrite argv[0], in C.. because it's near the top 
of the stack..  Doing that is also very nasty.  I really don't know why 
Apple thought this was a good idea.. seems they're using the argv[0] and 
pid as a key to tie events from the WindowServer back to the process, 
and apparently it knows what the argv[0] SHOULD be so if it's not 
copacetic it just doesn't work.

Almost wish I worked for Apple so I could see why this is and how to get 
it fixed :)

-bob


On Thursday, July 18, 2002, at 09:10 AM, Jeff Senn wrote:

>
> How can I get python to run from a terminal window (i.e. no idle and
> also stdio to the terminal) and also have Tk work?
>
> I tried the not-so-obvious:
>
>  cp /usr/local/bin/python pythonw
>  ./pythonw blah.py
>
> Which almost works -- I get windows but also the "SetFrontProcess 
> failed,-600"
> error when trying to interact with them...
>
> (I seem to recall this worked at some point...)
> --
> -Jas
>
>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig