[GRASS-user] Python scripting

Pedro Camargo veigacamargo at gmail.com
Fri Aug 17 15:22:06 PDT 2012


Hi guys,

	I'm starting to use Python to run an analysis that should take
several hours to process (a few minutes for each individual analysis, that
is why scripting is the way to go) but I'm getting some pretty weird errors
(using the shell inside the GUI). 

So I'll start my questions from the beginning:

	- Which is the python library from Grass that I have to reference? I
did not find any library called grass.py (which I'd guess would be called
given how one references it inside the python shell in Grass)
	- Testing the exec_command inside grass' python shell I get the
following:

grass.exec_command('r.stats', flags='', quiet=True, verbose=False, env=None,
input='FAZ_Raster at PERMANENT,CA2010 at PERMANENT',
output='C:\Users\Pedro\Downloads\GRASS\California2010\StatsO.txt')

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File
"C:\PROGRA~2\QUANTU~1\apps\grass\grass-6.4.2\etc\python\grass\script\core.py
", line 312, in exec_command
    os.execvpe(prog, args, env)
  File "C:\PROGRA~2\QUANTU~1\apps\Python27\lib\os.py", line 353, in execvpe
    _execvpe(file, args, env)
  File "C:\PROGRA~2\QUANTU~1\apps\Python27\lib\os.py", line 380, in _execvpe
    func(fullname, *argrest)
OSError: [Errno 2] No such file or directory

	Any ideas on where the error might be?

Thanks again,

	Pedro



More information about the grass-user mailing list