[GRASSGUI] python scripting support?

Glynn Clements glynn at gclements.plus.com
Tue Apr 10 06:34:10 EDT 2007


Jachym Cepicky wrote:

> > >> Any idea what would be the python equivalent of the bash lines...
> > >>
> > >> if [ "$1" != "@ARGS_PARSED@" ] ; then
> > >>   exec g.parser "$0" "$@"
> > >> fi
> > >
> > > AFAICT:
> > >
> > > if ( sys.argv[1] != "@ARGS_PARSED@" ):
> > > os.execv("g.parser", [sys.argv[0]] + sys.argv)
> 
> g.manual g.parser ;-)

The example given in the manual page is less than ideal, e.g. using
os.system() instead of os.execv(). This will fail if any of the
arguments contain spaces or other shell metacharacters.

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




More information about the grass-gui mailing list