[GRASS-dev] Re: [GRASSGUI] silly question - running a python
script
Michael Barton
michael.barton at asu.edu
Sun Jun 10 16:53:14 EDT 2007
OK. I've changed the WIKI accordingly.
Michael
On 6/10/07 1:46 PM, "Glynn Clements" <glynn at gclements.plus.com> wrote:
>
> Glynn Clements wrote:
>
>> Although the "try ... except IndexError" can be replaced with a length
>> check on sys.argv, i.e.:
>>
>> if __name__ == "__main__":
>> if ( len(sys.argv) > 1 && sys.argv[1] != "@ARGS_PARSED@" ):
>> os.execv("g.parser", [sys.argv[0]] + sys.argv)
>> else:
>> main()
>
> Correction:
>
> if __name__ == "__main__":
> if ( len(sys.argv) <= 1 or sys.argv[1] != "@ARGS_PARSED@" ):
> os.execvp("g.parser", [sys.argv[0]] + sys.argv)
> else:
> main();
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
More information about the grass-dev
mailing list