<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">Hi, I do not know if this is helpful, but the following worked, - after being confronted with the same error message:</p>

<p dir="auto">[1]</p>

<p dir="auto">See:</p>

<p dir="auto"><a href="https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Important_notes" style="color:#3983C4">https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Important_notes</a></p>

<p dir="auto">[2]</p>

<p dir="auto">The following worked for me with Michael Bartons 7.3 binaries. The location and mapset were created from outside GRASS</p>

<p dir="auto">In Terminal</p>

<p dir="auto">Install pip:</p>

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

<p dir="auto">Using /Users/jon/anaconda2/lib/python2.7/site-packages<br>
Processing dependencies for pip<br>
Finished processing dependencies for pip</p>

<p dir="auto">[3]</p>

<p dir="auto">Install grass-session</p>

<hr style="background:#333; background-image:linear-gradient(to right, #ccc, #333, #ccc); border:0; height:1px" height="1">

<p dir="auto">| ~ @ jons-iMac (jon) <br>
| => pip install grass-session<br>
Collecting grass-session<br>
  Downloading <a href="https://files.pythonhosted.org/packages/ae/be/5b9f707dff22529358c3d147373658a85599540addffbda9c629dcc97366/grass_session-0.1-py2.py3-none-any.whl" style="color:#3983C4">https://files.pythonhosted.org/packages/ae/be/5b9f707dff22529358c3d147373658a85599540addffbda9c629dcc97366/grass_session-0.1-py2.py3-none-any.whl</a><br>
Installing collected packages: grass-session<br>
Successfully installed grass-session-0.1<br>
You are using pip version 8.1.1, however version 18.0 is available.<br>
You should consider upgrading via the 'pip install --upgrade pip' command.</p>

<hr style="background:#333; background-image:linear-gradient(to right, #ccc, #333, #ccc); border:0; height:1px" height="1">

<p dir="auto">| ~ @ jons-iMac (jon) <br>
| => pip install --upgrade pip<br>
Collecting pip<br>
  Downloading <a href="https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl" style="color:#3983C4">https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl</a> (1.3MB)<br>
    100% |████████████████████████████████| 1.3MB 517kB/s <br>
Installing collected packages: pip<br>
  Found existing installation: pip 8.1.1<br>
    Uninstalling pip-8.1.1:<br>
      Successfully uninstalled pip-8.1.1<br>
Successfully installed pip-18.0</p>

<p dir="auto">[4]</p>

<p dir="auto">My script:</p>

<h1 style="font-size:1.4em">!/usr/bin/env python</h1>

<h1 style="font-size:1.4em">-<em>- coding:utf-8 -</em>-</h1>

<p dir="auto">from grass.script import core as grass<br>
from grass.script import db as grass</p>

<p dir="auto">from grass_session import Session<br>
from grass.script import core as gcore</p>

<h1 style="font-size:1.4em">create a new location from EPSG code</h1>

<p dir="auto">with Session(gisdb="/Users/jon/a_tmp", location="a_tmp_location", create_opts="EPSG:3057"):</p>

<p dir="auto">print '-'</p>

<h1 style="font-size:1.4em">create a new mapset in an existing location</h1>

<p dir="auto">with Session(gisdb="/tmp", location="location", mapset="test", create_opts=""):</p>

<p dir="auto">print '--'</p>

<p dir="auto">[5]</p>

<p dir="auto">In Terminal:</p>

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

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

<h2 style="font-size:1.2em">/Applications/GRASS/grass7.app/Contents/MacOS</h2>

<p dir="auto">--</p>

<p dir="auto">Cheers, Jon</p>

<p dir="auto">On 3 Sep 2018, at 14:49, Moritz Lennert wrote:</p>

</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">Hi,<br>
<br>
A student has been confronted with the following error trying to use grass_session on Mac:<br>
<br>
**********************<br>
from grass_session import Session<br>
<br>
GRASSBIN: /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS<br>
cmd: /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS --config path<br>
out: b''<br>
err: b'/bin/sh: /Applications/GRASS-.app/Contents/MacOS: No such file or directory\n'<br>
Traceback (most recent call last):<br>
File "<pyshell#24>", line 1, in <module><br>
from grass_session import Session<br>
File "/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/__init__.py", line 4, in <module><br>
from grass_session.session import (get_platform_name,<br>
File "/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/session.py", line 259, in <module><br>
GISBASE = get_grass_gisbase(grassbin=GRASSBIN)<br>
File "/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/session.py", line 75, in get_grass_gisbase<br>
"variable").format(grassbin=grassbin))<br>
RuntimeError: Cannot find GRASS GIS start script: /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS, set the right one using the GRASSBIN environm. variable<br>
<br>
************************************<br>
<br>
Does anyone have a hint ?<br>
<br>
Moritz<br>
<br>
<br>
_______________________________________________<br>
grass-user mailing list<br>
grass-user@lists.osgeo.org<br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" style="color:#777">https://lists.osgeo.org/mailman/listinfo/grass-user</a></p>
</blockquote></div>
<div style="white-space:normal">
</div>
</div>
</body>
</html>