[GRASS-windows] Calling GRASS functions from external Python

Brian Sanjeewa Rupasinghe jinkabs at gmail.com
Fri Dec 21 04:21:31 PST 2012


Hi all,

I have GRASS 6.4.3svn installed in my machine running Windows 7. Also in my
machine i installed Python 2.7.3 for Windows.
Now i need to call GRASS libraries from Python and not within the Python
shell in GRASS GUI itself. I set the environment variables
in the env.bat for this. But connection fails. This is the env.bat i have:

set GISBASE=C:\Program Files\GRASS GIS 6.4.3svn

set HOME=%USERPROFILE%

set LD_LIBRARY_PATH = %GISBASE%\lib

set PATH= %GISBASE%\etc;%PATH%
set PATH=%GISBASE%\Python27;%PATH%
set
PATH=%GISBASE%\lib;%GISBASE%\bin;%GISBASE%\extralib;%GISBASE%\msys\bin;%PATH%
set PATH=C:\Python27;%PATH%

set PYTHONLIB= C:\Python27;%PYTHONLIB%
set PYTHONPATH= %GISBASE%\etc\python;%PYTHONPATH%


rem Environmental variables for GRASS stand-alone installer

set GRASS_WISH=%GISBASE%\extrabin\wish.exe
set GRASS_PYTHON=python


set GRASS_PROJSHARE=%GISBASE%\proj
set GRASS_HTML_BROWSER=explorer
set GRASS_SH=%GISBASE%\msys\bin\sh.exe

set PYTHONHOME=%GISBASE%\Python27
set GDAL_DATA=%GISBASE%\share\gdal
set PROJ_LIB=%GISBASE%\proj
set GEOTIFF_CSV=%GISBASE%\share\epsg_csv

set PATH=%GISBASE%\msys\bin;%PATH%
set PATH=%GISBASE%\extrabin;%GISBASE%\extralib;%PATH%
set PATH=%GISBASE%\tcl-tk\bin;%GISBASE%\sqlite\bin;%GISBASE%\gpsbabel;%PATH%
set PATH=%GISBASE%\bin;%PATH%

rem Path to the python directory --
rem set PYTHONHOME=%GISBASE%\Python27
rem if "x%GRASS_PYTHON%" == "x" set GRASS_PYTHON=python

Can somebody help me in rectifying the problem.

Cheers, Brian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-windows/attachments/20121221/863e6402/attachment.html>


More information about the grass-windows mailing list