[GRASS-dev] g.gisenv in gui

Hamish hamish_nospam at yahoo.com
Mon Jun 11 03:39:23 EDT 2007


Michael:
> > Likewise, you can¹t get it to print out current environment settings
> > from the gui unless you do some tricks with its execution.

Glynn:
> AFAICT, the problem with g.gisenv is that it checks for argc==1 before
> calling G_parser(), so e.g. "g.gisenv --quiet" causes that check to
> fail.

g.gisenv just outputs to stdout. There's no G_message() or G_percent()
or anything that would use --quiet. Just treat g.gisenv like it were
"ls" and send the output to a buffer or a temp file.

for example:

>>> import os
>>> prog = os.popen("g.gisenv")
>>> print prog.read()
LOCATION_NAME='spearfish60';
MAPSET='user1';
DIGITIZER='none';
GISDBASE='/home/hamish/grassdata';
DEBUG='0';
MONITOR='x0';
GRASS_GUI='text';


# for shell vars (replace grep filter with python version)
>>> import os
>>> prog = os.popen("set | grep '^GIS\|^GRASS_'")
>>> print prog.read()


nothing more to do here AFAICS....

?
Hamish




More information about the grass-dev mailing list