[GRASS-dev] python with grass

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.

___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com

On Thu, Jun 4, 2009 at 7:56 PM, Danho Fursy Rodelec
Neuba<danho_f@yahoo.fr> 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")
from grass.lib import grass
import random
grass.G_gisinit('')
...

Markus

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@gclements.plus.com>