[GRASS-dev] backporting lib/python to devbr6

Glynn Clements glynn at gclements.plus.com
Sat Jul 26 09:59:56 EDT 2008


Martin Landa wrote:

> I would like to backport Glynn's lib/python stuff to devbr6 and use it
> in wxGUI (not just only in trunk). E.g.
> 
> grass.gisenv()['MAPSET']

grass.gisenv() will run g.gisenv for each call.

It would be better to save the result, i.e.:

	env = grass.gisenv()
	...
	... = env['MAPSET']

But in wxGUI, you might want a more sophisticated interface, which
allows environment changes. E.g. returning the environment as a
UserDict object which runs "g.gisenv set=..." whenever it's updated
(os.environ is implemented similarly; it calls putenv() whenever an
entry is updated).

Or maybe it would be better to just write out the internal environment
to a temporary $GISRC file for each command.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list