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

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Sun Mar 7 22:01:37 EST 2010


Νίκος:
>  Is there a way to lock-out all
> > other versions of grass-modules from being detectable when I am already
> > inside a grass70 session?

Glynn:
> 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:

I get the following error:
--%<---
/geo/osgeo/src/grass6_devel/dist.x86_64-unknown-linux-gnu/etc/prompt.sh:
2: g.gisenv: not found
/geo/osgeo/src/grass6_devel/dist.x86_64-unknown-linux-gnu/etc/prompt.sh:
2: g.gisenv: not found
/geo/osgeo/src/grass6_devel/dist.x86_64-unknown-linux-gnu/etc/prompt.sh:
2: g.gisenv: not found
--%<---

So I did some modifications (see below). Sorry for the noob questions
(and editing).


-- code --
> 	strippath()
> 	{
> 	    (
> 	    oldpath="$1"
> 	    newpath=
> 	    IFS=:
> 	    for dir in $oldpath ; do
> 		case "${dir}" in
> 		*grass*)
> 			;;
> 		*)
> 			newpath="$newpath:$dir"
> 			;;
> 		esac
> 	    done
> 	    echo "${newpath#:}"
--> here I added "unset IFS": wrong, right or not required?

> 	    )
> 	}
> 	
> 	PATH=`strippath $PATH`
I changed that to:
         PATH="$GISBASE/bin:$GISBASE/scripts:`strippath $PATH`"

	
> 	export GISBASE=$PWD/dist.i686-pc-linux-gnu
-(a)-> changed the 2nd part to "dist.x86_64-unknown-linux-gnu"
-(b)-> I don't understand the logic behind "$PWD" here. From within a
grass65 or grass70 session why need to re-define $GISBASE? It's already
set.

> 	export PATH="$GISBASE/bin:$GISBASE/scripts:$PATH"
(moved up to the "PATH=...")

> 	export LD_LIBRARY_PATH="$GISBASE/lib"
> 	export PYTHONPATH="$GISBASE/etc/python"
-- end of code --


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

OK! It works like that for me when sourcing inside a grass65, grass70
session. Paths point to wanted grass version. Or am I in the wrong
direction?

Thanks, Nikos



More information about the grass-user mailing list