[GRASS-user] gparser example for v.to.rast

Hello,

Is there a command to get the gparser code for a certain module from
the GRASS command line? like v.to.rast --gparser.
This is interesting to me as I 'd like to know how get certain parts
of the interactive form also implemented in my own python module.

Thanks,

cheers,
/johannes
--
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
Jetzt informieren: http://www.gmx.net/de/go/freephone/

Johannes wrote:

Is there a command to get the gparser code for a
certain module from the GRASS command line? like
v.to.rast --gparser.

yes,

v.to.rast --script

for python make the first line
#!/usr/bin/env python

instead of

#!/bin/sh

and replace the bits after the end of the #% lines
with something like,

import grass.script as grass

def main():
    ...code goes here

    ...end of your code

if __name__ == "__main__":
    options, flags = grass.parser()
    atexit.register(cleanup)
    main()

explore the python scripts in grass7/scripts/ for
examples.

Hamish

Hi Hamish,

thank you…

–script

this was the hint I was looking for… I just couldn’t remember.

/johannes