[GRASS-user] Write python grass program with osgeo4w
Moskovitz, Bob
Bob.Moskovitz at conservation.ca.gov
Wed Jun 17 14:07:35 EDT 2009
I changed grass.py with the changes in changeset 37075. Although I'm no longer getting any error messages, I am not able to see my script help by simply typing "m.test.py --help".
When I try "python C:\OSGeo4W\apps\grass\grass-6.4.0svn\scripts\m.test.py --help", I do see the help. Without "--help", m.test.py doesn't start up in a gui.
What must be done to make python scripts to behave like regular grass commands?
Bob
> -----Original Message-----
> From: Glynn Clements [mailto:glynn at gclements.plus.com]
> Sent: Saturday, June 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:
>
> http://trac.osgeo.org/grass/changeset/37075
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
More information about the grass-user
mailing list