[GRASS-user] can I access mapset outside of grass, by using python?

Glynn Clements glynn at gclements.plus.com
Wed Mar 3 23:22:14 EST 2010


Νίκος  	Αλεξανδρής wrote:

>  I've set-up my system based on your detailed descriptions/instructions
> below (old post) using grass64.
> 
> 1. Would you mind sharing in addition the way you change between
> mapsets/locations? Do you start a new shell session after re-defining
> somehow the variables LOCATION_NAME or/and MAPSET? Use just g.gisenv?

Use g.mapset.

> 2. Also, I have compiled (but _not_ installed) grass65 and grass70 and
> run them from "dist" directory, i.e. I launch grass70 via
> "../grass_trunk/dist.x86_64-unknown-linux-gnu/grass70.tmp".
> 
> Now, I launch grass70 for testing, I try "d.mon" and I get:
> ---
> Incompatible library version for module. You need to rebuild GRASS
>        or untangle multiple installations.
> ---
> 
> I would expect the module not to be found at all since it doesn't exist
> in grass70. Could this be a problem? Is there a way to lock-out all
> other versions of grass-modules from being detectable when I am already
> inside a grass70 session?

The grassXY scripts prepend the GRASS directories to PATH,
LD_LIBRARY_PATH, etc. They won't remove any entries which are already
there.

I only use the grassXY scripts if I actually need to test the startup
process. To switch versions, I use the following script:

	strippath()
	{
	    (
	    oldpath="$1"
	    newpath=
	    IFS=:
	    for dir in $oldpath ; do
		case "${dir}" in
		*grass*)
			;;
		*)
			newpath="$newpath:$dir"
			;;
		esac
	    done
	    echo "${newpath#:}"
	    )
	}
	
	PATH=`strippath $PATH`
	
	export GISBASE=$PWD/dist.i686-pc-linux-gnu
	export PATH="$GISBASE/bin:$GISBASE/scripts:$PATH"
	export LD_LIBRARY_PATH="$GISBASE/lib"
	export PYTHONPATH="$GISBASE/etc/python"

Note: the above script needs to be "source"d; executing it won't work.

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


More information about the grass-user mailing list