[GRASS-user] Write python grass program with osgeo4w

Moskovitz, Bob Bob.Moskovitz at conservation.ca.gov
Mon Jun 15 02:05:59 EDT 2009

I see that GRASS in OSGEO4W is only up to r36506.  Hopefully there will be an update to OSGEO4W soon...maybe even an update to GRASS 6.4 RC5 :-)

-----Original Message-----
From: Glynn Clements [mailto:glynn at gclements.plus.com]
Sent: Sat 6/13/2009 7:56 AM
To: Moskovitz, Bob
Cc: Grass-User (E-mail)
Subject: Re: [GRASS-user] Write python grass program with osgeo4w

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:


Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list