[GRASS-dev] python parser question

Hamish hamish_b at yahoo.com
Wed May 13 06:05:47 EDT 2009


Hi,

the python version of m.proj in trunk now has:

#%option
#% key: fs
#% type: string
#% description: Field separator (format: input,output)
#% required : no
#% key_desc : character,character
#% answer : |,|
#%end


Question:
if the fs is a comma (.csv), won't that come to grief here:
    #### parse field separator
    ifs, ofs = fs.split(',')


I find the current way to be too much typing. could it be like
#% answer : input_fs[,output_fs]

so most of the time you don't need a,b? (if b==NULL then b=a)

(AFAIR the parser does special "2 input options required" checks
if you use opt->key_desc="a,b")


or is fs_in= and fs_out= needed to please both the parser and the python?

or do we need a new
    elif ifs.lower() == "comma":
(I'd rather avoid that)


thanks,
Hamish


More information about the grass-dev mailing list