[GRASS-user] grass-python scripting error

Milton Cezar Ribeiro miltinho.astronauta at gmail.com
Mon May 25 00:23:40 EDT 2009


Dear all,

I am trying to play with grass & python, and I am trying to
reproduce the first example available at
http://grass.osgeo.org/wiki/GRASS_and_Python
with the following adaptation:
----------------------
#!/usr/bin/env python
import sys
import grass

def main():
     drape_map = options['MQ_simulation_050001_p023_h007']
     relief_map = options['MQ_simulation_050010_p010_h013']
     brighten = options['brighten']
     ret = grass.run_command("d.his", h_map = drapemap,  i_map = relief_map,
brighten = brighten)
     return 0

if __name__ == "__main__":
     options, flags = grass.parser()
     sys.exit(main())
-----------


To try this I started MSYS, started GRASS with -gui option,
and then typed the name of the script (python_grass03.py): The error looks
like:
----............................
GRASS 6.4.0RC4 (SDB_PL_teste):/c/Data/Paisagens_Simuladas/teste_python >
python_grass03.py
Traceback (most recent call last):
  File "./python_grass03.py", line 13, in <module>
    options, flags = grass.parser()
  File "C:\OSGeo4W\apps\grass\grass-6.4.0RC4\etc\python\grass.py", line 208,
in parser
    os.execvp("g.parser", [name] + argv)
  File "c:\Python25\lib\os.py", line 354, in execvp
    _execvpe(file, args)
  File "c:\Python25\lib\os.py", line 390, in _execvpe
    func(fullname, *argrest)
OSError: [Errno 2] No such file or directory
----............................



The environment of my grass session looks like
-------------------++++++++++++++++++++
GRASS 6.4.0RC4 (SDB_PL_teste):/c/Data/Paisagens_Simuladas/teste_python > set
!::='::\'
!C:='C:\'
ALLUSERSPROFILE='C:\ProgramData'
APPDATA='C:\Users\famiglia\AppData\Roaming'
ARCGISHOME='C:\Program Files (x86)\ArcGIS\'
BASH=/bin/sh
BASH_VERSINFO=([0]="2" [1]="04" [2]="0" [3]="1" [4]="release"
[5]="i686-pc-msys")
BASH_VERSION='2.04.0(1)-release'
BGCOLOR=LightYellow
COLORFGBG='default;default'
COLORTERM=rxvt
COLUMNS=97
COMMONPROGRAMFILES='C:\Program Files (x86)\Common Files'
COMMONPROGRAMFILES(X86)='C:\Program Files (x86)\Common Files'
COMMONPROGRAMW6432='C:\Program Files\Common Files'
COMPUTERNAME=FAMIGLIA-PC
COMSPEC='C:\Windows\SysWOW64\cmd.exe'
DFSTRACINGON=FALSE
DIRSTACK=()
DISPLAY=:0
EUID=500
FGCOLOR=Navy
FP_NO_HOST_CHECK=NO
GDAL_DATA='C:\OSGeo4W\share\gdal'
GEOTIFF_CSV='C:\OSGeo4W\share\epsg_csv'
GISBASE=/c/OSGeo4W/apps/grass/grass-6.4.0RC4
GISRC=/tmp/grass6-famiglia-6244/gisrc
GIS_LOCK=6244
GRASS_GNUPLOT='gnuplot -persist'
GRASS_HTML_BROWSER='C:\Program Files (x86)\Internet Exporer\iexplore'
GRASS_LD_LIBRARY_PATH='/c/OSGeo4W/apps/grass/grass-6.4.0RC4/lib:/c/OSGeo4W/bin:/c/OSGeo4W/apps/grass/grass-6.4.0RC4/bin:/c/OSGeo4W/apps/grass/grass-6.4.0RC4/scripts:.:/usr/local/bin:/mingw/bin:/bin:/osgeo4w/bin:/osgeo4w/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Program
Files (x86)/ATI
Technologies/ATI.ACE/Core-Static:/c/Python26:/c/gdalwin32-1.6/bin:/c/msys/1.0:/c/msys/1.0/bin:/c/Program
Files (x86)/Java/jre6/bin:/bin:/bin'
GRASS_PAGER=less
GRASS_PERL=no
GRASS_PROJSHARE='C:\OSGeo4W\share\proj'
GRASS_PYTHON=python
GRASS_SH=/bin/sh
GRASS_TCLSH=tclsh
GRASS_VERSION=6.4.0RC4
GRASS_WISH=/c/OSGeo4W/bin/wish.exe
GROUPS=()
HISTFILE=/c/Users/famiglia/.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOME=/c/Users/famiglia
HOMEDRIVE=C:
HOMEPATH='\'
HOSTNAME=FAMIGLIA-PC
HOSTTYPE=i686
IFS='
'
LINES=45
LOCALAPPDATA='C:\Users\famiglia\AppData\Local'
LOGNAME=famiglia
LOGONSERVER='\\FAMIGLIA-PC'
MACHTYPE=i686-pc-msys
MAILCHECK=60
MAKE_MODE=unix
MINGW32BGCOLOR=LightYellow
MINGW32FGCOLOR=Navy
MSYSBGCOLOR=White
MSYSCON=rxvt.exe
MSYSFGCOLOR=Black
MSYSTEM=MINGW32
NUMBER_OF_PROCESSORS=4
OLDPWD=/usr/bin
OPTERR=1
OPTIND=1
OS=Windows_NT
OSGEO4W_ROOT='C:\OSGeo4W'
OSTYPE=msys
PATH='/c/OSGeo4W/apps/grass/grass-6.4.0RC4/lib:/c/OSGeo4W/bin:/c/OSGeo4W/apps/grass/grass-6.4.0RC4/bin:/c/OSGeo4W/apps/grass/grass-6.4.0RC4/scripts:.:/usr/local/bin:/mingw/bin:/bin:/osgeo4w/bin:/osgeo4w/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Program
Files (x86)/ATI
Technologies/ATI.ACE/Core-Static:/c/Python26:/c/gdalwin32-1.6/bin:/c/msys/1.0:/c/msys/1.0/bin:/c/Program
Files (x86)/Java/jre6/bin:/bin:/bin'
PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
PIPESTATUS=([0]="1")
PPID=6244
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_ARCHITEW6432=AMD64
PROCESSOR_IDENTIFIER='Intel64 Family 6 Model 23 Stepping 10, GenuineIntel'
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=170a
PROGRAMDATA='C:\ProgramData'
PROGRAMFILES='C:\Program Files (x86)'
PROGRAMFILES(X86)='C:\Program Files (x86)'
PROGRAMW6432='C:\Program Files'
PROJ_LIB='C:\OSGeo4W\share\proj'
PROMPT='$P$G'
PS1='GRASS 6.4.0RC4 (SDB_PL_teste):\w > '
PS2='> '
PS4='+ '
PUBLIC='C:\Users\Public'
PWD=/c/Data/Paisagens_Simuladas/teste_python
PYTHONHOME=/c/OSGeo4W/apps/grass/grass-6.4.0RC4/etc/python:/c/Python25
PYTHONPATH='/c/OSGeo4W/apps/grass/grass-6.4.0RC4/etc/python:/c/Python25:C:\Python25\;C:\Program
Files (x86)\ArcGIS\bin;C:\OSGeo4W\apps\grass\grass-6.4.0RC4\etc\python'
SESSIONNAME=Console
SHELL=/bin/sh
SHELLOPTS=braceexpand:hashall:histexpand:monitor:history:interactive-comments:emacs
SHLVL=4
SYSTEMDRIVE=C:
SYSTEMROOT='C:\Windows'
TEMP=/tmp
TERM=msys
TMP=/tmp
TRACE_FORMAT_SEARCH_PATH='\\NTREL202.ntdev.corp.microsoft.com
\34FB5F65-FFEB-4B61-BF0E-A6A76C450FAA\TraceFormat'
UID=500
USERDOMAIN=famiglia-PC
USERNAME=famiglia
USERPROFILE='C:\Users\famiglia'
WD='C:\OSGeo4W\apps\msys\\bin\'
WINDIR='C:\Windows'
WINDOWID=167838960
_=python_grass03.py
-------------------++++++++++++++++++++

I am running GRASS 6.4R4 under MSYS and VISTA.

Any hint are welcome.

bests
milton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20090525/02528707/attachment.html


More information about the grass-user mailing list