[GRASS-windows] Creating Python scripts that call GRASS functionality from outside (UNCLASSIFIED)

Brian Sanjeewa Rupasinghe jinkabs at gmail.com
Sat Dec 22 08:57:26 PST 2012


Hi,

Even if the GISRC environmental variable set, i cannot call GRASS libraries
from Python 2.7 IDLE.
For example, when i import grass from grass.lib, it gives the following
error in Python IDLE (GUI)

ImportError: No module named grass.lib

Here is the env.bat file i modified. Newly added lines are below rem #---

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 #----

set PATH=%GISBASE%\lib;%PATH%
set PATH= %GISBASE%\etc;%PATH%
set PATH=%GISBASE%\etc\python;%PATH%
set PATH=C:\Python27;%PATH%

set GISRC= C:\Users\KABS\AppData\Roaming\GRASS6\grassrc6
set LD_LIBRARY_PATH = %GISBASE%\lib
set PYTHONLIB= C:\Python27
set PYTHONPATH= %GISBASE%\etc\python;%PYTHONPATH%


On Sat, Dec 22, 2012 at 3:58 PM, Brian Sanjeewa Rupasinghe <
jinkabs at gmail.com> wrote:

> Many thanks. I got it.
>
> On Sat, Dec 22, 2012 at 1:39 PM, Glynn Clements <glynn at gclements.plus.com>wrote:
>
>
>> Brian Sanjeewa Rupasinghe wrote:
>> .
>> > Thanks. It is found in  C:\Users\<username>\AppData\Roaming. However the
>> > file name is grassrc6 and not .grassrc6.
>> > Is it ok?
>>
>> Yes.
>>
>> It doesn't matter what the file is called, so long as %GISRC% points
>> to it and it contains the necessary settings.
>>
>> --
>> Glynn Clements <glynn at gclements.plus.com>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-windows/attachments/20121222/a9ae9f31/attachment.html>


More information about the grass-windows mailing list