[GRASS-dev] No module named grass.script

Zoltan Szecsei zoltans at geograph.co.za
Sun Feb 9 03:44:31 PST 2020


Hi,
I've just installed OSGEO4W64
Grass 7.8.2 works (alone), as does Grass functionality through QGIS 
3.10.2 (with Grass 7.8.2).

I am now trying to put together a python 3.7 script using PyCharm 
2019.3.3 Community edition.
I start PyCharm using the cmd script below.

My python script fails (in the Pycharm IDE) on import grass.script as 
gscript.

I have set GISBASE, GRASSBIN and PATH in the windows env setup.
Please can someone point me in the correct direction to be able to write 
python scripts using grass modules, in pycharm.

Thanks and regards,
Zoltan.



My pycharm startup script is:
@echo off
SET OSGEO4W_ROOT=C:\OSGeo4W64
call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
call "%OSGEO4W_ROOT%"\apps\grass\grass78\etc\env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin
path %PATH%;%OSGEO4W_ROOT%\apps\grass\grass78\lib
path %PATH%;%OSGEO4W_ROOT%\apps\Qt5\bin
path %PATH%;%OSGEO4W_ROOT%\apps\Python37\Scripts

set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python
set 
PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\grass\grass78\etc\python\grass
SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python37
SET PYTHONPATH=%PYTHONHOME%;%PYTHONHOME%\Scripts
PATH %PYTHONPATH%;%PATH%

set PATH=C:\Program Files\Git\bin;%PATH%

start "PyCharm aware of Quantum GIS" /B "C:\Program 
Files\JetBrains\PyCharm Community Edition 2019.2\bin\pycharm64.exe"


-- 

=============================================
Zoltan Szecsei GPrGISc 0031
Geograph (Pty) Ltd.
GIS and Photogrammetric Services

P.O. Box 7, Muizenberg 7950, South Africa.

Mobile: +27-83-6004028     (WhatsApp only)
Qatar:  +974 5083 2722     www.geograph.co.za
=============================================



More information about the grass-dev mailing list