[GRASS-user] issue with grass_session on MacOSX: Cannot find GRASS GIS start script

Jón Eiríksson jeir at hi.is
Mon Sep 3 10:12:06 PDT 2018


Hi, I do not know if this is helpful, but the following worked, - after 
being confronted with the same error message:

[1]

See:

https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Important_notes



[2]

The following worked for me with Michael Bartons 7.3 binaries. The 
location and mapset were created from outside GRASS

In Terminal

Install pip:

| => sudo easy_install pip
Password:
Searching for pip
Best match: pip 8.1.1
Adding pip 8.1.1 to easy-install.pth file
Installing pip script to /Users/jon/anaconda2/bin
Installing pip2.7 script to /Users/jon/anaconda2/bin
Installing pip2 script to /Users/jon/anaconda2/bin

Using /Users/jon/anaconda2/lib/python2.7/site-packages
Processing dependencies for pip
Finished processing dependencies for pip

[3]

Install grass-session
  ________________________________________________________________________________
| ~ @ jons-iMac (jon)
| => pip install grass-session
Collecting grass-session
   Downloading 
https://files.pythonhosted.org/packages/ae/be/5b9f707dff22529358c3d147373658a85599540addffbda9c629dcc97366/grass_session-0.1-py2.py3-none-any.whl
Installing collected packages: grass-session
Successfully installed grass-session-0.1
You are using pip version 8.1.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' 
command.
  ________________________________________________________________________________
| ~ @ jons-iMac (jon)
| => pip install --upgrade pip
Collecting pip
   Downloading 
https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl 
(1.3MB)
     100% 
|████████████████████████████████| 
1.3MB 517kB/s
Installing collected packages: pip
   Found existing installation: pip 8.1.1
     Uninstalling pip-8.1.1:
       Successfully uninstalled pip-8.1.1
Successfully installed pip-18.0



[4]

My script:

#!/usr/bin/env python
#-*- coding:utf-8 -*-

from grass.script import core as grass
from grass.script import db as grass

from grass_session import Session
from grass.script import core as gcore

# create a new location from EPSG code
with Session(gisdb="/Users/jon/a_tmp", location="a_tmp_location", 
create_opts="EPSG:3057"):

    print '-'



# create a new mapset in an existing location
with Session(gisdb="/tmp", location="location", mapset="test", 
create_opts=""):

    print '--'


[5]

In Terminal:

| => export GISBASE="/Applications/GRASS-7.3.app/Contents/MacOS"
| => export PYTHONPATH="${PYTHONPATH}:$GISBASE/etc/python/"
| => export LD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$GISBASE/lib"
| => export GIS_LOCK=$$
| => export GISRC="/Users/jon/.grass7"


| => GRASSBIN=/Applications/GRASS/grass7.app/Contents/MacOS/grass.sh 
python a.py
GRASSBIN: /Applications/GRASS/grass7.app/Contents/MacOS/grass.sh
GISBASE: Rebuilding Addon HTML manual pages index...
Rebuilding Addon menu...
Python 2.7.10 found.
/Applications/GRASS/grass7.app/Contents/MacOS
-
--


Cheers, Jon


On 3 Sep 2018, at 14:49, Moritz Lennert wrote:

> Hi,
>
> A student has been confronted with the following error trying to use 
> grass_session on Mac:
>
> **********************
> from grass_session import Session
>
> GRASSBIN: /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS
> cmd: /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS --config path
> out: b''
> err: b'/bin/sh: /Applications/GRASS-.app/Contents/MacOS: No such file 
> or directory\n'
> Traceback (most recent call last):
> File "<pyshell#24>", line 1, in <module>
> from grass_session import Session
> File 
> "/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/__init__.py", 
> line 4, in <module>
> from grass_session.session import (get_platform_name,
> File 
> "/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/session.py", 
> line 259, in <module>
> GISBASE = get_grass_gisbase(grassbin=GRASSBIN)
> File 
> "/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/session.py", 
> line 75, in get_grass_gisbase
> "variable").format(grassbin=grassbin))
> RuntimeError: Cannot find GRASS GIS start script: 
> /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS, set the right one 
> using the GRASSBIN environm. variable
>
> ************************************
>
> Does anyone have a hint ?
>
> Moritz
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180903/f23afc3f/attachment-0001.html>


More information about the grass-user mailing list