[GRASS-dev] python with grass

Glynn Clements glynn at gclements.plus.com
Sat Jun 6 06:36:06 EDT 2009


Markus Neteler wrote:

> > Hy everybody,
> > this is me again. Bound_box work very well and i am  happy. I need to
> > know something new. When I can launch my program directly in grass using
> > python test.py there is this error message:
> >  File "test.py", line 4, in <module>
> >    from grass.lib import grass as gl6
> > ImportError: No module named lib
> > When I am in  python environment it is possible to import grass from
> > grass.lib. Can you tell me why i got this error.
> 
> Just for the record of the list archive (since you found out
> already):
> 
> import sys
> sys.path.append("/usr/local/grass-6.4.0svn/etc/python")

The GRASS startup scripts should have already added this directory to
PYTHONPATH.

If you aren't within a GRASS session (GISBASE, GISRC set), most GRASS
library functions won't work.

If you're setting up the GRASS environment manually, you need to set
PYTHONPATH as well.

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


More information about the grass-dev mailing list