[GRASS-user] Parsing options to g.parse in script

Michel Wortmann wortmann at pik-potsdam.de
Thu Jul 3 03:18:51 PDT 2014


Hi all,
g.parse or in python grass.parser() is great when it comes to reading 
command line input, it's options and their attributes (key, type, 
answer, options...), however, are hardcoded into each script. I wonder 
if it was possible to change these options at script run time, which 
would tremendously improve the GUI and command line script usability. 
This is what I'm thinking of:

- first read in some values form a model parameter file
- parse those to grass.parser
- open GUI in --ui mode
- user can change input or leave it as it is
- run module

So far I have done this by first setting the commandline arguments in 
python (sys.argv) to some value and then call grass.parser(), but thats 
more of a workaround and I still cant change the options or any of the 
other g.parser #% options (i.e. those that are hardcoded).

Any ideas are much appreciated.
Regards,
Michel


More information about the grass-user mailing list