[GRASS-user] Problems with GRASS python code in osgeo4w
Moskovitz, Bob
Bob.Moskovitz at conservation.ca.gov
Mon Jun 22 19:07:23 EDT 2009
There is no etc/python/grass/script/core.py. Just etc\python\grass.py. Here is a part of a pdb debug session:
> c:\osgeo4w\apps\grass\grass-~1.0sv\etc\python\grass.py(208)parser()
-> if sys.platform == "win32":
(Pdb)
> c:\osgeo4w\apps\grass\grass-~1.0sv\etc\python\grass.py(209)parser()
-> try:
(Pdb)
> c:\osgeo4w\apps\grass\grass-~1.0sv\etc\python\grass.py(210)parser()
-> os.execvp("g.parser.exe", [name] + argv)
(Pdb) p [name] + argv
['c:\\osgeo4w\\apps\\grass\\grass-6.4.0svn\\scripts\\m.dipslope.py', 'c:\\osgeo
4w\\apps\\grass\\grass-6.4.0svn\\scripts\\m.dipslope.py']
(Pdb)
> -----Original Message-----
> From: Glynn Clements [mailto:glynn at gclements.plus.com]
> Sent: Monday, June 22, 2009 3:30 PM
> To: Moskovitz, Bob
> Cc: Grass-User (E-mail)
> Subject: RE: [GRASS-user] Problems with GRASS python code in osgeo4w
>
>
>
> 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