greeting experts.
i’m attempting to “import grass.script” in python unsuccessfully (ImportError: No module named grass.script) ive set the environment variables according to this http://grass.osgeo.org/wiki/GRASS_and_Python#General_guides on ubuntu x64 Natty. can anyone recommend a solution? i used ‘which grass’ to determine the GISBASE variable (/usr/bin/grass).
grass.py exists at /usr/lib/grass64/etc/python/grass/lib/grass.py
thanks very much
–
Peter
Peter Tittmann wrote:
i'm attempting to "import grass.script" in python unsuccessfully
(ImportError: No module named grass.script) ive set the environment
variables according to this
http://grass.osgeo.org/wiki/GRASS_and_Python#General_guides on ubuntu
x64 Natty. can anyone recommend a solution? i used 'which grass' to
determine the GISBASE variable (/usr/bin/grass).
That's wrong. GISBASE needs to point to the root of the GRASS
installation directory, which contains everything *except* for the
startup script (typically in /usr/bin or /usr/local/bin). A typical
value for GISBASE is /usr/local/grass-6.4.0.
grass.py exists at /usr/lib/grass64/etc/python/grass/lib/grass.py
In which case, GISBASE should probably be set to /usr/lib/grass64, and
PYTHONPATH should include /usr/lib/grass64/etc/python.
--
Glynn Clements <glynn@gclements.plus.com>
Hi there,
*Apologies for double posting. My original post was send before I
subscribed to the mailing list and is still pending and has not been sent to
the mailing list. I think the Admin is away from the office at the moment,
hence this repost.*
I have been trying to set my machine up so I can run Grass commands from
Python on an Ubuntu1104 64bit system. I have come across similar problems
listed on this site and elsewhere loading the grass.script. But having
tried to follow the advice I still can't import the script in python.
Can anyone help!
So in the terminal I start python and run the following line of code with
the resulting error:
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import grass.script as grass
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named grass.script
Having consulted the following page on the subject:
http://grass.osgeo.org/wiki/GRASS_and_Python
I have added the following lines to my .bashrc file and restarted my system
but I still get the same error:
export GISBASE=usr/lib/grass64
export
PATH=$PATH:/home/neil/segmentation:/$GISBASE/bin:/$GISBASE/scripts:/$GISBASE/etc:/$GISBASE/lib:/usr/lib64/python2.7:/$GISBASE/etc/python/grass:/$GISBASE/etc/python/grass/lib:/$GISBASE/etc/python/grass/script
export GISRC=$HOME/.grassrc6
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib
export PYTHONPATH=$GISBASE/etc/python
export PYTHONLIB=/usr/lib64/python2.7
Does anyone have any other ideas on what to try to get things working?
Many Thanks in advance.
NB. It may be worth noting that I have noticed there is also python2.6 files
on my machine in case there are other files that need checking regarding the
python path.
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/python-scripts-load-error-tp6033724p6478127.html
Sent from the Grass - Users mailing list archive at Nabble.com.
Neil_Alex wrote:
I have added the following lines to my .bashrc file and restarted my system
but I still get the same error:
export GISBASE=usr/lib/grass64
There should be a leading slash:
export GISBASE=/usr/lib/grass64
--
Glynn Clements <glynn@gclements.plus.com>