Hi all!
I'm trying to write a grass7 add-ons, but I'm fighting with one
parameter that wont work... and I'm not able to understand where the
problem is...
the python code is:
{{{
#!/usr/bin/env python
# -- coding: utf-8 --
#%Module
#% description: Test
#% keywords: test
#% keywords: options
#% overwrite: yes
#%End
#%option
#% key: hdf
#% type: string
#% description: Name of the HDF file
#% required: yes
#%end
#%option
#% key: ychk
#% type: string
#% description: Name for the training values in the HDF
#% required: no
#%end
#%option
#% key: Kchk
#% type: string
#% description: Name for the training values in the HDF
#% required: no
#%end
from grass.script import parser
def main(opts, flgs):
for k, v in opts.items():
print "%s = %r" % (k, v)
if __name__ == "__main__":
options, flags = parser()
main(options, flags)
}}}
the Makefile is:
{{{
MODULE_TOPDIR = ../..
PGM=r.try
include $(MODULE_TOPDIR)/include/Make/Script.make
default: script
}}}
The script is working If I don't use the Kchk parameter:
{{{
r.try hdf=result.hdf ychk=y_chk
hdf = 'result.hdf'
Kchk = ''
ychk = 'y_chk'
}}}
otherwise it raise an error:
{{{
r.try hdf=result.hdf ychk=y_chk Kchk=K_chk
Description:
Test
Keywords:
test, options
Usage:
r.try hdf=string [ychk=string] [Kchk=string] [--overwrite]
[--verbose] [--quiet]
Flags:
--o Allow output files to overwrite existing files
--v Verbose module output
--q Quiet module output
Parameters:
hdf Name of the HDF file
ychk Name for the training values in the HDF
Kchk Name for the training values in the HDF
ERROR: Sorry <Kchk=K_chk> is not a valid option
}}}
Do you understand what I'm doing wrong? why is ychk working?
I'm using grass r57429
Best regards.
Pietro