Bug report #1748

(windows) GRASS gui does not show if GRASS was run with wxpyhton interface

Added by Paolo Cavallini over 14 years ago. Updated about 14 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:GRASS
Affected QGIS version: Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:11808

Description

The GRASS shell is currently not working in OSGeo 1.2 windows package. When opening it, a cmd.exe window pops up, but GRASS shell variables are not initialized

History

#1 Updated by Jürgen Fischer over 14 years ago

Which variables are unset? Which package are you referring to?

#2 Updated by Paolo Cavallini over 14 years ago

If I type a GRASS command, e.g. g.region, I get an error message about GRASS variables not being set. Tested with qgis-dev (1.2) from OSGeo installer.
Thanks.

#3 Updated by Giovanni Manghi over 14 years ago

Replying to [comment:1 jef]:

Which variables are unset? Which package are you referring to?

the message is

ERROR: G_getenv(): Variable GRASS_GUI not set

used qgis 1.2 installed with the osgeo4w installer

#4 Updated by Giovanni Manghi over 14 years ago

Made a further test with the osgeo4w installer (using qgis 1.2) on windows xp.

A first try to use a grass command in the shell returned the following

C:\\>v.in.ogr
Traceback (most recent call last):
  File "C:\\OSGeo4W\\apps\\grass\\GRASS-~1.0SV/etc/wxpython/gui_modules/menuform.py" 
, line 1933, in <module>
    [[GrassGUIApp]]( grassTask( sys.argvr1 ) ).MainLoop()
  File "C:\\OSGeo4W\\apps\\grass\\GRASS-~1.0SV/etc/wxpython/gui_modules/menuform.py" 
, line 336, in +init+
    xml.sax.parseString( getInterfaceDescription( grassModule ) , processTask( s
elf ) )
  File "C:\\OSGeo4W\\apps\\grass\\GRASS-~1.0SV/etc/wxpython/gui_modules/menuform.py" 
, line 1753, in getInterfaceDescription
    cmdout = p.sub(globalvar.ETCDIR + r'/grass-interface.dtd', cmdout)
  File "C:\\OSGeo4W\\apps\\Python25\\lib\
e.py", line 269, in _subx
    template = _compile_repl(template, pattern)
  File "C:\\OSGeo4W\\apps\\Python25\\lib\
e.py", line 256, in _compile_repl
    raise error, v # invalid expression
sre_constants.error: bad group name

as it seemed to try use the wxpyhton interface, then I uninstalled everything and reinstalled without wx-pyhton. This way the GRASS tcltk interface still works, but this time the grass shell under qgis does nothing

C:\\>v.in.ogr
C:\\>

but it is still able to recognize wrong commands.

#5 Updated by Giovanni Manghi over 14 years ago

My latest comment was obviously regarding trying to open the grass gui by issuing a command with no parameters. When issuing grass commands with parameters the shell seems to work fine.

I noticed also that under windows if the grass shell is open and one close qgis, than the shell remains open. I don't know if this has to be considered a issue or an inevitable thing.

#6 Updated by Paolo Cavallini over 14 years ago

It seems to me that is reasonably working now: can we close it?

#7 Updated by Giovanni Manghi over 14 years ago

Replying to [comment:6 pcav]:

It seems to me that is reasonably working now: can we close it?

It doesn't seems to me. I Just checked on the latest qgis-dev version installed with the osgeo4w package, and I found all the problems described in this ticket.

I first get a "ERROR: G_getenv(): Variable GRASS_GUI not set" then I played around with the GRASS installation (osgeo4w installs both the tcltk and wxpython GRASS interfaces) and went back to the qgis GRASS plugin.

I then get the same error reported above (if GRASS is configured to start with the wxpython interface) or nothing at all (if GRASS is configured to start with the tcltk interface).

Again the only situation that the shell seems to work is if you issue a command together with its own parameters. No way to get the GRASS interface pop up by just issuing the command name.

#8 Updated by Giovanni Manghi about 14 years ago

Hi,

I tested again qgis-dev (6b9f41d8 (SVN r12904)) installed with osgeo4w (there was recently an update of the GRASS packages) and the good news it that apparently, now issuing a GRASS command with no parameters, in the qgis GRASS shell make the program to correctly open the native tcl-tk GRASS interface.

A problem still remains:
if for some reasons GRASS is launched with the new wxpython interface then, when a command (with no paramters) is issued in the qgis GRASS shell, an error is returned

C:\\>v.in.ogr
Traceback (most recent call last):
  File "C:\\OSGeo4W\\apps\\grass\\GRASS-~1.0SV/etc/wxpython/gui_modules/menuform.py" 
, line 1942, in <module>
    [[GrassGUIApp]]( grassTask( sys.argvr1 ) ).MainLoop()
  File "C:\\OSGeo4W\\apps\\grass\\GRASS-~1.0SV/etc/wxpython/gui_modules/menuform.py" 
, line 334, in +init+
    xml.sax.parseString( getInterfaceDescription( grassModule ) , processTask( s
elf ) )
  File "C:\\OSGeo4W\\apps\\grass\\GRASS-~1.0SV/etc/wxpython/gui_modules/menuform.py" 
, line 1762, in getInterfaceDescription
    cmdout = p.sub(globalvar.ETCDIR + r'/grass-interface.dtd', cmdout)
  File "C:\\OSGeo4W\\apps\\Python25\\lib\
e.py", line 269, in _subx
    template = _compile_repl(template, pattern)
  File "C:\\OSGeo4W\\apps\\Python25\\lib\
e.py", line 256, in _compile_repl
    raise error, v # invalid expression
sre_constants.error: bad group name

to overcome this problem is enough to re-run GRASS with the tcl-tk interface.

#9 Updated by Redmine Admin about 14 years ago

GRASS wxpython fails if GISBASE contains a backslash, so it is bug in GRASS I think.
I have added conversion \\ -> / to QgsGrass::shortPath so it should be fixed.

To be verified with next qgis-dev build.

#10 Updated by Giovanni Manghi about 14 years ago

I tested the latest qgis-dev with osgeo4w under Windows Seven and tried to launch the GRASS interface from the qgis GRASS plugin shell:

the message is

ERROR: G_getenv(): Variable GRASS_GUI not set

but no more errors like the one I posted in this ticket, if the user had launched before the GRASS wxpython interface. Just

ERROR: G_getenv(): Variable GRASS_GUI not set

The same now happens also under XP (it used to work), the message is the same.

#11 Updated by Redmine Admin about 14 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

I have set the default GRASS_GUI to wxpython in 49a6486d (SVN r13058).

Also available in: Atom PDF