Hi Gary,

I was afraid of such a answer :) Yeah, unfortunately I've put too much code 
into template instead of WeeWX service.

Thanks anyway :)

Dne sobota 17. dubna 2021 v 6:32:47 UTC+2 uživatel gjr80 napsal:

> Hi,
>
> Unfortunately sometimes Cheetah gives only limited info and often the best 
> you can do is try to deduce from the error message where or what the error 
> is. As you have no doubt found you cannot use the line number referred to 
> in the error trace, that is a line number in temporary file created by 
> Cheetah and we don't have access to that file.
>
> In your case I would start by looking in your template for any explicit 
> uses of float() to convert a string to a float. The argument of the float() 
> call is something that is impossible to convert to a float. It's possible 
> the float() could be in some WeeWX code called by the CheetahGenerator but 
> I suspect not or you would have seen a different error trace. One approach 
> is to start commenting out template code to track down the location of the 
> error.
>
> It's hard to offer much more advice without seeing your template code. 
> Again not seeing your code and not knowing what you are trying to do, but 
> this is one reason why parsing data from an external source is often best 
> done in a Search List Extension or a WeeWX service where you can use pure 
> python that is far easier to debug. Templates are usually best left to just 
> formatting output wherever possible.
>
> Gary
>
> On Saturday, 17 April 2021 at 14:15:00 UTC+10 [email protected] wrote:
>
>>
>> Hello,
>>
>> is there any possibility how to debug weewx output to identify line in 
>> template which causes error? I had to restore snapshot of my machine from 
>> previous day backup and discovered this error which wasn't visible before. 
>> I am parsing API from openweather on several places and don't wanna go line 
>> by line and test. Thanks for hints.
>>
>> Apr 17 06:10:17 new-weather-machine journal: weewx[5310] INFO 
>> weewx.restx: PWSWeather: Published record 2021-04-17 06:10:00 CEST 
>> (1618632600)
>> Apr 17 06:10:18 new-weather-machine journal: weewx[5310] INFO 
>> weewx.restx: OWM: Published record 2021-04-17 06:10:00 CEST (1618632600)
>> Apr 17 06:10:19 new-weather-machine journal: weewx[5310] ERROR 
>> weewx.cheetahgenerator: Generate failed with exception '<type 
>> 'exceptions.ValueError'>'
>> Apr 17 06:10:19 new-weather-machine journal: weewx[5310] ERROR 
>> weewx.cheetahgenerator: **** Ignoring template 
>> /etc/weewx/skins/neowx/index.html.tmpl
>> Apr 17 06:10:19 new-weather-machine journal: weewx[5310] ERROR 
>> weewx.cheetahgenerator: **** Reason: could not convert string to float:
>> Apr 17 06:10:19 new-weather-machine journal: weewx[5310] ERROR 
>> weewx.cheetahgenerator: ****  Traceback (most recent call last):
>> Apr 17 06:10:19 new-weather-machine journal: weewx[5310] ERROR 
>> weewx.cheetahgenerator: ****    File 
>> "/usr/share/weewx/weewx/cheetahgenerator.py", line 326, in generate
>> Apr 17 06:10:19 new-weather-machine journal: weewx[5310] ERROR 
>> weewx.cheetahgenerator: ****      unicode_string = 
>> compiled_template.respond()
>> Apr 17 06:10:19 new-weather-machine journal: weewx[5310] ERROR 
>> weewx.cheetahgenerator: ****    File 
>> "cheetah__etc_weewx_skins_neowx_index_html_tmpl_1618632018_51_95540.py", 
>> line 1506, in respond
>> Apr 17 06:10:19 new-weather-machine journal: weewx[5310] ERROR 
>> weewx.cheetahgenerator: ****  ValueError: could not convert string to float:
>> Apr 17 06:10:25 new-weather-machine journal: weewx[5310] INFO 
>> weewx.cheetahgenerator: Generated 15 files for report StandardReport in 
>> 7.57 seconds
>> Apr 17 06:10:25 new-weather-machine journal: weewx[5310] INFO 
>> weewx.reportengine: Copied 0 files to /var/www/html/weewx
>>
>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/16093c7e-a876-4fe9-ad96-58117c17050dn%40googlegroups.com.

Reply via email to