[GRASS-user] Write python grass program with osgeo4w

Glynn Clements glynn at gclements.plus.com
Sat Jun 13 10:56:19 EDT 2009


Moskovitz, Bob wrote:

> A coworker and I have been trying to use the first example in
> <http://download.osgeo.org/grass/grass6_progman/pythonlib.html>
> http://download.osgeo.org/grass/grass6_progman/pythonlib.html.  We
> discovered that "import grass.script as grass" has to be changed to
> "import grass".  Below is the example and the error we are getting is
> this:
>  
> C:\>m.test.py
> Traceback (most recent call last):
>   File "C:\OSGeo4W\apps\grass\GRASS-~1.0SV/scripts\m.test.py", line 31, in <module>
>     options, flags = grass.parser()
>   File "C:\OSGeo4W\apps\grass\GRASS-~1.0SV\etc\python\grass.py", line 208, in parser
>     os.execvp("g.parser", [name] + argv)
>   File "C:\OSGeo4W\apps\Python25\lib\os.py", line 353, in execvp
>     _execvpe(file, args)
>   File "C:\OSGeo4W\apps\Python25\lib\os.py", line 389, in _execvpe
>     func(fullname, *argrest)
> OSError: [Errno 22] Invalid argument
>  
>  
> Any ideas what is going on?

This is a bug in grass.py; Windows requires "g.parser.exe" rather than
"g.parser". This was fixed with:

	http://trac.osgeo.org/grass/changeset/37075

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list