Open andrew-plowright opened 5 years ago
Dear @andrew-plowright ,
sorry for the delay, I think you believe to use python37, but actually the osgeo grass binary file is using python27. Please, check in your script which python version are you using with the following lines:
import sys
print(sys.version)
Let me know the result.
Hi @zarch . No worries. I can confirm that I've set all the environment variables to ensure that Python37 is being used:
import sys
print(sys.version)
3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
GRASS 7.8 will be the first version with support for Python 3. So, I would say this is no grass-session issue.
@andrew-plowright, please test the release candidate that will be made available the next days...
FYI: Meanwhile GRASS GIS 7.8.0 with Python 3 support is out
Thanks for the update!
Hello. I've been able to get
grass.script
running in a Python script usinggrass_session
. I have encountered one issue when using OSGeo4W, which I've been able to solve by using a very inelegant solution. I am wondering if this could be solved by updatinggrass_session
?I am using version 7.4.2 of grass, installed with the latest version of OSGeo in Windows. My Python script contains the following code:
I am calling it from the command line using the Python37 interpreter that comes with Osgeo. I set the following environmental variables first.
This produces the following error:
I did some digging and, as the error message suggests, the problem lies within
\grass-7.4.2\etc\python\grass\script\core.py
. After having made a back-up, I changed the lines 37-45 of this file from this:To this:
After having made this change, everything works. I don't entirely understand why, but obviously having to edit grass files is not a great solution. Do you know if this is something that can be resolved using
grass_session
, or by perhaps changing some environmental variables that I wasn't aware of?Thank you for your time