Thanks Gary.

All this is a learning curve for me.
I will have a crack at this tomorrow and see what happens.
I worked out most of the other things that didn't work by trial and error 
(mostly error) 
I wasn't in a hurry to get the gauges to work and I know you would be busy 
looking at other more important things and I appreciate you answering the 
question.
I built a 20.04 server on real hardware just to test all of this and have a 
script to rebuild it again once I iron the bugs out.

Again Thanks

On Thursday, 7 May 2020 17:03:06 UTC+10, gjr80 wrote:
>
> As you are no doubt aware by now tracking down python errors that occur in 
> a template (as distinct from python errors in a SLE or the WeeWX code base) 
> can be a real pain as we can't reconcile the line number given in the error 
> message with any source code. The following line tells us the error is in 
> some in-line python code in the gauge-data.txt.tmpl template:
>
> May  7 09:35:24 jed165 weewx[2390] ERROR weewx.cheetahgenerator: ****    
> File "_etc_weewx_skins_ss_gauge_data_txt_tmpl.py", line 339, in respond
>
> If the error was in an SLE or the WeeWX code base we would have a nicely 
> named (and known) .py (eg mySLE.py or cheetahgenerator.py) file rather 
> than the cryptic name above. We can't use the line number from 
> _etc_weewx_skins_ss_gauge_data_txt_tmpl.py as it is a temporary file 
> created by Cheetah that we have no access to. The only thing we can use 
> is the error message text, in your case:
>
> May  7 09:35:24 jed165 weewx[2390] ERROR weewx.cheetahgenerator: ****  
> TypeError: '>' not supported between instances of 'NoneType' and 'int'
>
> That message tells us a few things. We know that we have an error in an 
> expression involving '>' (greater than). As it turns out > appears in the 
> template only twice, at lines 69 and 277:
>
> #if $h > 0
>
> and
>
> #if $hour.rain.sum.raw > $hourlyrainTH
>
> We also know the left hand side is equating to None (the cause of the 
> error) and the right hand side of the comparison is equating to an integer. 
> If we look at line 69 if $h was None that would throw the error we are 
> getting (0 in considered an int). $h is calculated at the line 68 and 
> indirectly involves lines 66 and 67:
>
> #set $dp_K = $current.dewpoint.degree_C.raw + 273.16
> #set $e = 6.11 * math.exp(5417.7530 * ((1/273.16) - 1/$dp_K))
> #set $h = 0.5555 * ($e - 10.0)
>
> We know $dp_K is not None; if it was we would get and error on line 66 
> where $dp_K is calculated (None + 273.16). Therefore we know $h cannot be 
> None. So line 69 is not the source of the error.
>
> If we look at line 277 to get the error we are seeing $hour.rain.sum.raw 
> would need to be None and $hourlyrainTH would need to be an int. 
> $hourlyrainTH is initialised to 0 at line 274, so $hourlyrainTH could be 
> well be an int. Could $hour.rain.sum.raw be None, quite possible if there 
> is no rain data (as distinct from there being data but it is 0) for a full 
> hour sometime today. So it looks like we have found the problem line. How 
> to fix it? Given the purpose of that piece of that piece of code is to find 
> the hour of the highest rainfall today we can just put another conditional 
> in there so we skip hours with no rainfall data, eg (not tested):
>
> #for $hour in $day.hours
> #if $hour.rain.sum.raw is not None and $hour.rain.sum.raw > $hourlyrainTH 
> #set $hourlyrainTH = $hour.rain.sum.raw
>
> Now if $hour.rain.sum.raw is None the first conditional will cause 
> execution to skip the rest of the if statement avoiding the problematic '>'.
>
> Apologies this was somewhat long winded, but I thought it a perfect 
> opportunity to highlight one of the (few) techniques for tracking down 
> in-line python errors in templates.
>
> Gary
>
> On Thursday, 7 May 2020 09:52:07 UTC+10, Greg from Oz wrote:
>>
>> I can live without the gauges. Below is the error:
>>
>> May  7 09:35:24 jed165 weewx[2390] DEBUG weewx.reportengine: Running 
>> report 'SteelSeries'
>> May  7 09:35:24 jed165 weewx[2390] DEBUG weewx.reportengine: Found 
>> configuration file /etc/weewx/skins/ss/skin.conf for report 'SteelSeries'
>> May  7 09:35:24 jed165 weewx[2390] INFO weewx.reportengine: Copied 0 
>> files to /var/www/html/weather/ss
>> May  7 09:35:24 jed165 weewx[2390] DEBUG weewx.cheetahgenerator: Using 
>> search list ['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.S
>> tation', 'weewx.cheetahgenerator.Current', 
>> 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo', 
>> 'weewx.cheetahgenerator.Extras']
>> May  7 09:35:24 jed165 weewx[2390] DEBUG weewx.manager: Daily summary 
>> version is 2.0
>> May  7 09:35:24 jed165 weewx[2390] ERROR weewx.cheetahgenerator: Generate 
>> failed with exception '<class 'TypeError'>'
>> May  7 09:35:24 jed165 weewx[2390] ERROR weewx.cheetahgenerator: **** 
>> Ignoring template /etc/weewx/skins/ss/gauge-data.txt.tmpl
>> May  7 09:35:24 jed165 weewx[2390] ERROR weewx.cheetahgenerator: **** 
>> Reason: '>' not supported between instances of 'NoneType' and 'int'
>> May  7 09:35:24 jed165 weewx[2390] ERROR weewx.cheetahgenerator: ****  
>> Traceback (most recent call last):
>> May  7 09:35:24 jed165 weewx[2390] ERROR weewx.cheetahgenerator: ****    
>> File "/usr/share/weewx/weewx/cheetahgenerator.py", line 322, in genera
>> te
>> May  7 09:35:24 jed165 weewx[2390] ERROR weewx.cheetahgenerator: ****    
>>   unicode_string = compiled_template.respond()
>> May  7 09:35:24 jed165 weewx[2390] ERROR weewx.cheetahgenerator: ****    
>> File "_etc_weewx_skins_ss_gauge_data_txt_tmpl.py", line 339, in respon
>> d
>> May  7 09:35:24 jed165 weewx[2390] ERROR weewx.cheetahgenerator: ****  
>> TypeError: '>' not supported between instances of 'NoneType' and 'int'
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/fce9cd24-026f-49f6-a2fa-894dcaa22317%40googlegroups.com.

Reply via email to