[GRASS-dev] OSX Snow Leopard problem with python

William Kyngesburye woklist at kyngchaos.com
Mon Sep 7 11:22:56 EDT 2009

On Sep 7, 2009, at 9:16 AM, Markus Neteler wrote:

> On Mon, Sep 7, 2009 at 1:28 AM, William
> Kyngesburye<woklist at kyngchaos.com> wrote:
>> I had some problems getting wxpython GUI to run after upgrading to  
>> OSX 10.6
>> Snow Leopard.  I thought I might need to rebuild (I was using the  
>> Leopard
>> binaries), but that doesn't help.
>> When I got GRASS to execute to correct Python (another issue I know  
>> how to
>> workaround), starting the GUI does nothing.  With DEBUG level 5, I  
>> get:
>> GRASS 6.5.svn (spearfish60):~ > g.gui wxpython
>> D1/5: Attempting to start 'wxpython' GUI ...
>> D3/5: forking 'python' ...
>> re-executing using pythonw
>> GRASS 6.5.svn (spearfish60):~ >
>> And the GUI never appears.
> I have tried here on Mandriva 64bit
> GRASS 6.5.svn (patUTM32):~/grass65 > g.gisenv set=DEBUG=5
> GRASS 6.5.svn (patUTM32):~/grass65 > g.gui wxpython
> D1/5: Attempting to start 'wxpython' GUI ...
> D3/5: forking 'python' ...
> GRASS 6.5.svn (patUTM32):~/grass65 >
> Same thing - old map appears, disappears and that's it.
I don't even get anything that appears, just quiet.

> On Mon, Sep 7, 2009 at 5:37 AM, William
> Kyngesburye<woklist at kyngchaos.com> wrote:
>> After some tinkering, I found that the utils.reexec_with_pythonw()  
>> is not
>> working.  I was able to manually run the GUI by commenting the
>> utils.reexec_with_pythonw() lines in wxgui.py and menuform.py and  
>> starting
>> the gui with
>> pythonw "$GISBASE/etc/wxpython/wxgui.py"
> I see it only in wxgui.py:
> Index: wxgui.py
> ===================================================================
> --- wxgui.py    (revision 39055)
> +++ wxgui.py    (working copy)
> @@ -1608,7 +1608,7 @@
>     #
>     # reexec for MacOS
>     #
> -    utils.reexec_with_pythonw()
> +    #utils.reexec_with_pythonw()
>     #
>     # process command-line arguments
> Unfortunately it does not help.

menuform.py is in gui_modules subfolder.  I didn't see that one at  
first also, and the GUI didn't start until I fixed both of them.

> I see http://trac.osgeo.org/grass/ticket/594
> which seems to be related.
> Perhaps some more magic is needed (bad URL with spaces)?
> http://wiki.wxpython.org/Automatically Calling pythonw on Mac OS X
(hehe, and Mail's automatic URL recognition stopped at 'Automaticaly')

No spaces, or other odd chars, in the path to pythonw or GRASS.

I wonder if there is just something wrong with that reexec function  
definition, since you have a similar problem on Linux (where it never  
attempts the exec).

A couple other oddities I noticed:

- menuform.py has a shebang (and hardwired to /usr/bin/python), but  
it's only ever imported

- the reexec in menuform.py is redundant

But fixing these didn't help...

And, a potential problem: the reexec doesn't respect the GRASS_PYTHON  
setting.  g.gui starts using GRASS_PYTHON, but the reexec is simply  
'pythonw', which may not be from the same python build.  I could even  
set GRASS_PYTHON to a specific pythonw, but it will still reexec with  

William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>

[Trillian]  What are you supposed to do WITH a maniacally depressed  

[Marvin]  You think you have problems?  What are you supposed to do if  
you ARE a maniacally depressed robot?  No, don't try and answer, I'm  
50,000 times more intelligent than you and even I don't know the  

- HitchHiker's Guide to the Galaxy

More information about the grass-dev mailing list