<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 1, 2015 at 8:39 AM, Pietro <span dir="ltr"><<a href="mailto:peter.zamb@gmail.com" target="_blank">peter.zamb@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Anna,<br>
<div><div class="h5"><br>
On Wed, Apr 1, 2015 at 1:49 PM, Anna Petrášová <<a href="mailto:kratochanna@gmail.com">kratochanna@gmail.com</a>> wrote:<br>
><br>
><br>
> On Wed, Apr 1, 2015 at 6:46 AM, Pietro <<a href="mailto:peter.zamb@gmail.com">peter.zamb@gmail.com</a>> wrote:<br>
>><br>
>> Dear Umberto,<br>
>><br>
>> On Wed, Apr 1, 2015 at 11:46 AM, umberto.minora <<a href="mailto:umberto.minora@unimi.it">umberto.minora@unimi.it</a>><br>
>> wrote:<br>
>> > File "C:\OSGeo4W\apps\grass\grass-7.0.0\etc\python\grass\p<br>
>> > ygrass\modules\interface\parameter.py", line 150, in<br>
>> > __init__<br>
>> > self.values = [self.type(i) for i in diz['values']]<br>
>> > ValueError: invalid literal for int() with base 10: '1-'<br>
>><br>
>> The problem here is that the r.sun.hourly define the parmeter nprocs as:<br>
>><br>
>> {{{<br>
>> #%option<br>
>> #% key: nprocs<br>
>> #% type: integer<br>
>> #% description: Number of r.sun processes to run in parallel<br>
>> #% options: 1-<br>
>> #% answer: 1<br>
>> #%end<br>
>> }}}<br>
>><br>
>> To me this "#% options: 1-" is wrong, and it does not make to much<br>
>> sense. I'm keen on removing this row.<br>
>><br>
>> Vaclav and Anna, what is it your feeling?<br>
><br>
><br>
> I think it makes sense, it means greater or equal to 1. It is supported by<br>
> the parser, so you might find more of these cases in other modules.<br>
<br>
</div></div>The only cases available are in the grass-addons:<br>
<br>
{{{<br>
$ grep --color=auto --exclude-dir={.svn,.git,.OBJ,locale} -IrnE<br>
"^#%\s+options: 1-$"<br>
<br>
grass_addons/grass7/raster/r.lake.series/r.lake.series.py:95:#% options: 1-<br>
grass_addons/grass7/raster/r.shaded.pca/r.shaded.pca.py:85:#% options: 1-<br>
grass_addons/grass7/raster/r.sun.daily/r.sun.daily.py:129:#% options: 1-<br>
grass_addons/grass7/raster/r.sun.hourly/r.sun.hourly.py:120:#% options: 1-<br>
}}}<br>
<br></blockquote><div>...and me or Anna are authors of these modules. There is also nothing like this in the C modules:<br><br>grep --color=auto --exclude-dir={.svn,.git,.OBJ,locale} -IrnE "options.*=.*1-"<br><br></div><div>However, the question is what is supported by the parser. There is unfortunately no documentation and that's probably the source of confusion but looking to the source code I see that 1- and -100 is allowed:<br><br><a href="http://grass.osgeo.org/programming7/parser_8c_source.html#l01144">http://grass.osgeo.org/programming7/parser_8c_source.html#l01144</a><br><br><span class=""><span class="">1162</span> <span class="">i</span>f</span> (contains(opt, <span class="">'-'</span>)) {
<div class=""><a name="l01163"></a><span class=""> 1163</span> <span class="">if</span> (sscanf(opt, <span class="">"%d-%d"</span>, &lo, &hi) == 2) {</div>
<div class=""><a name="l01164"></a><span class=""> 1164</span> <span class="">if</span> (d >= lo && d <= hi)</div>
<div class=""><a name="l01165"></a><span class=""> 1165</span> <span class="">return</span> 0;</div>
<div class=""><a name="l01166"></a><span class=""> 1166</span> }</div>
<div class=""><a name="l01167"></a><span class=""> 1167</span> <span class="">else</span> <span class="">if</span> (sscanf(opt, <span class="">"-%d"</span>, &hi) == 1) {</div>
<div class=""><a name="l01168"></a><span class=""> 1168</span> <span class="">if</span> (d <= hi)</div>
<div class=""><a name="l01169"></a><span class=""> 1169</span> <span class="">return</span> 0;</div>
<div class=""><a name="l01170"></a><span class=""> 1170</span> }</div>
<div class=""><a name="l01171"></a><span class=""> 1171</span> <span class="">else</span> <span class="">if</span> (sscanf(opt, <span class="">"%d-"</span>, &lo) == 1) {</div>
<div class=""><a name="l01172"></a><span class=""> 1172</span> <span class="">if</span> (d >= lo)</div>
<div class=""><a name="l01173"></a><span class=""> 1173</span> <span class="">return</span> 0;</div>
<div class=""><a name="l01174"></a><span class=""> 1174</span> }</div>
<div class=""><a name="l01175"></a><span class=""> 1175</span> <span class="">else</span></div>
<div class=""><a name="l01176"></a><span class=""> 1176</span> <span class="">return</span> <a class="" href="http://grass.osgeo.org/programming7/parser_8c.html#a41312e21c216ba49d374e84389fce29aa47fb4e9df6010b10ef18b436004bdc1b">BAD_SYNTAX</a>;</div>
<div class=""><a name="l01177"></a><span class=""> 1177</span> }</div><br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I fix this in r64969.<br>
<br>
See you soon.<br>
<span class=""><font color="#888888"><br>
Pietro<br>
</font></span></blockquote></div><br></div></div>