Hello,

I am trying to run a Python script which uses Grass library. I must say that 
grass was installed on my machine (windows 7) through installation of QGIS. 
Hence the Grass main folder is located in C:\Program Files (x86)\Quantum GIS 
Lisboa\apps\grass\grass-6.4.2  

Here is the python code I tried to use to set up the environment variables. 
Unfortunately when running the last line "import grass.script" , I get an error 
message saying that grass library could not be found. I have tried different 
things but I cant figure out what I am missing.

####
import os,sys,atexit,time

os.environ['GISBASE'] = 'C:\\Program Files (x86)\\Quantum GIS 
Lisboa\\apps\\grass\\grass-6.4.2'
os.environ['GISRC'] = 'C:\Users\Pierric\AppData\Roaming\GRASS6\grassrc6'
os.environ['LD_LIBRARY_PATH'] = os.path.join(os.environ['GISBASE'],'lib')
    
os.environ['PATH'] = 
os.environ['PATH']+';%s\\etc;%s\\etc\\python;%s\\lib;%s\\bin;%s\\bin;C:\\Program
 Files (x86)\\Quantum GIS 
Lisboa\\apps\\msys\\bin;C:\\Python27;%s\\etc\\python\\grass;%s\\etc\\python\\grass\\script;%s\\etc\\python\\grass\\lib'
 % ((os.environ['GISBASE'],)*8)
        
os.environ['GRASS_SH'] = 'C:\Program Files (x86)\Quantum GIS 
Lisboa\apps\msys\bin\sh.exe'
os.environ['PYTHONLIB'] = 'C:\Python27'
os.environ['PYTHONPATH'] = os.path.join(os.environ['GISBASE'],'etc','python')
        

import grass.script as grass
### 
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to