[GRASS-user] Problems with GRASS python code in osgeo4w

Glynn Clements glynn at gclements.plus.com
Mon Jun 22 18:30:29 EDT 2009

Moskovitz, Bob wrote:

> Thanks for the info.  I didn't know about the assoc and ftype.  Looking
> at the output of these two commands, I see that my system is set up
> correctly.  
> So, I still don't know why the grass.parser() is not working for me.  I
> even modified my program to use pdb to see what is happening.  The
> debugger is aborted right after I reach os.execvp("g.parser.exe", [name]
> + argv) in grass.py.  But if I use "python
> c:\osgeo4w\apps\grass\grass-6.4.0svn\scripts\m.dipslope.py --help", I
> get the expected results.

Does it work if you run the script using its full path, i.e.:

 c:\osgeo4w\apps\grass\grass-6.4.0svn\scripts\m.dipslope.py --help


You could try modifying etc/python/grass/script/core.py to print the
arguments which are passed to g.parser.

The code attempts to determine the script's full pathname, as g.parser
needs this so that it can open the script to read the #% comments
(PATH won't help here).

It appears that this part is where the problem lies. If the script is
run with --help or --ui, g.parser doesn't get around to re-invoking
the script, so that isn't an issue.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list