[GRASS-dev] [GRASS GIS] #534: g.gui doesn't work in ms-windows

#534: g.gui doesn't work in ms-windows
-------------------------+--------------------------------------------------
Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: default | Version: unspecified
Keywords: | Platform: MSWindows XP
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
From a self-compiled version (mingw/msys), or osgeo4w version, g.gui fails
to restart the gui on windows. For the osgeo4w version I created a grass64
file and started from within an msys shell. No error messages appear in
either case.

Fails to restart either the tcltk or wxpython gui

{{{
GRASS 6.4.0RC3 (Latlong):/d > g.gui wxpython
GRASS 6.4.0RC3 (Latlong):/d >
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.0
Component: default | Version: unspecified
Resolution: fixed | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Changes (by cnielsen):

  * status: new => closed
  * resolution: => fixed

Comment:

seems to be fixed

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: default | Version: unspecified
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Changes (by neteler):

  * status: closed => reopened
  * resolution: fixed =>

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: default | Version: svn-releasebranch64
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Changes (by neteler):

  * version: unspecified => svn-releasebranch64

Comment:

The problem persists on WindowsXP, Japanese version. See attachement.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Changes (by neteler):

  * component: default => wxGUI

Comment:

I tried with "tcltk" as parameter and it works. So the problem is "only"
to launch "wxpython", in general g.gui.exe seems to be ok.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Comment (by glynn):

Replying to [comment:4 neteler]:
> I tried with "tcltk" as parameter and it works. So the problem is "only"
to launch "wxpython", in general g.gui.exe seems to be ok.

So the problem is with wxGUI, not g.gui? Does:
{{{
$GRASS_PYTHON $GISBASE/etc/wxpython/wxgui.py &
}}}
work?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Comment (by glynn):

Replying to [comment:5 glynn]:

> Does:
{{{
$GRASS_PYTHON $GISBASE/etc/wxpython/wxgui.py &
}}}
> work?

Duh; this is Windows; that should be:
{{{
"%GRASS_PYTHON%" "%WINGISBASE%\etc\wxpython\wxgui.py"
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Comment (by neteler):

Tested: the (simple) problem is that "%GRASS_PYTHON%" is not defined at
all. When defining it manually (set GRASS_PYTHON=python), also g.gui
works.

I see that the variable is defined in lib/init/init.sh but not in any .bat
file.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Changes (by heshikik):

* cc: heshikik (added)

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Comment (by hamish):

Replying to [comment:7 neteler]:
> I see that the variable is defined in lib/init/init.sh but not
> in any .bat file.

only by mswindows/osgeo4w/ini.bat.tmpl?

{{{
osgeo4w/ini.bat.tmpl:5:set GRASS_PYTHON=%OSGEO4W_ROOT%\bin\python.exe
}}}

Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Comment (by hamish):

testing on wingrass prev binary r40019-

from the "GRASS 6.4.SVN with MSYS" terminal prompt $GRASS_PYTHON is set
(presumably by init.sh) and "g.gui wxpython" works.

from the "GRASS Command Line" menu item DOS-box %GRASS_PYTHON% is not set
and "g.gui wxpython" fails unless I set it. It is best to fix init.bat of
course, but perhaps we could also add a check to see if the getenv() in
g.gui.c is empty, and if it is default to "python"?

Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534#comment:10&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Comment (by neteler):

Replying to [comment:10 hamish]:
> from the "GRASS Command Line" menu item DOS-box %GRASS_PYTHON% is not
set and "g.gui wxpython" fails unless I set it. It is best to fix init.bat
of course, but perhaps we could also add a check to see if the getenv() in
g.gui.c is empty, and if it is default to "python"?

A default sounds good to me (just to "python") - if python is absent it
would fail in any case.

Markus

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/534#comment:11&gt;
GRASS GIS <http://grass.osgeo.org>

This trac comment apparently didn't make it to the list:

http://trac.osgeo.org/grass/ticket/534#comment:12

patch attached to this ticket vs. trunk to solve this in three different ways/places.

I'm a bit murky on the G_store() usage, so review before committing.

Hamish

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Comment (by hamish):

setting GRASS_PYTHON=python at the DOS prompt works.

I've committed to all branches the init.sh and grass.bat fixes from the
patch. see svn r40435-7.

Putting a fail-safe in g.gui.c still needs to be decided but is not a
blocker for release.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/534#comment:13&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords: wingrass
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Changes (by hamish):

  * keywords: => wingrass

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/534#comment:14&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords: wingrass
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Comment (by hamish):

I'm a bit murky on the G_store() usage, so review.

{{{
svn diff trunk/general/g.gui/main.c
Index: main.c

--- main.c (revision 40408)
+++ main.c (working copy)
@@ -27,7 +27,7 @@
      struct Option *type, *rc_file;
      struct Flag *update, *nolaunch;
      struct GModule *module;
- const char *gui_type_env;
+ const char *gui_type_env, *python_cmd;
      char progname[GPATH_MAX];

      G_gisinit(argv[0]);
@@ -103,14 +103,19 @@

      G_debug(1, "Attempting to start '%s' GUI ...", type->answer);

+ python_cmd = getenv("GRASS_PYTHON");
+
+ if(!python_cmd)
+ python_cmd = G_store("python");
+
      if (strcmp(type->answer, "wxpython") == 0) {
         sprintf(progname, "%s/etc/wxpython/wxgui.py", G_gisbase());
         if (rc_file->answer) {
- G_spawn_ex(getenv("GRASS_PYTHON"), progname, progname,
+ G_spawn_ex(python_cmd, progname, progname,
                     "--workspace", rc_file->answer, SF_BACKGROUND, NULL);
         }
         else {
- G_spawn_ex(getenv("GRASS_PYTHON"), progname, progname,
+ G_spawn_ex(python_cmd, progname, progname,
                     SF_BACKGROUND, NULL);
         }
      }
}}}

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/534#comment:15&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: reopened
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: | Keywords: wingrass
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Comment (by glynn):

Replying to [comment:13 hamish]:

> Putting a fail-safe in g.gui.c still needs to be decided but is not a
blocker for release.

It would also need to go into lib/gis/parser.c, g.mapsets/main.c,
scripts/wxpyimgview/wxpyimgview.py, v.krige.py and d.rast.edit.py (when
they eventually get fixed), and anything else which uses $GRASS_PYTHON.

IOW, it '''needs''' to be set in the startup scripts. Adding workarounds
for specific cases is fixing the symptoms rather than the bug.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/534#comment:16&gt;
GRASS GIS <http://grass.osgeo.org>

#534: g.gui doesn't work in ms-windows
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Resolution: fixed | Keywords: wingrass
  Platform: MSWindows XP | Cpu: Unspecified
---------------------------+------------------------------------------------
Changes (by hamish):

  * status: reopened => closed
  * resolution: => fixed

Comment:

ok, primary subject of bug is fixed on all platforms; adding multiple
layers of redundancy to deal with missing GRASS_PYTHON and GRASS_WISH
enviro variables will be a wontfix. we can reconsider that later if it
ever becomes a real problem.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/534#comment:17&gt;
GRASS GIS <http://grass.osgeo.org>