I don't know if it is related to your error, but I am surprised by the tag 
itself :  "$days_ago($days_ago=$n).dateTime.raw"
According to Weewx documentation, "$days-ago=x" should be used with the 
"day" aggregation  :   *$day*($days_ago=$n).dateTime.raw
see http://www.weewx.com/docs/customizing.htm#general_aggregation_periods 

Le mercredi 5 avril 2023 à 02:45:16 UTC+2, Tom Keffer a écrit :

> I don't know anything about the Sofaskin, but I do know that the line you 
> posted is unlikely to be causing the error. A ".raw" value is not formatted 
> at all. It is simply passed through. Of course, some magic might be 
> happening in the first $days_ago, so it's possible I am wrong.
>
> Finding Cheetah errors can be very tough. Frequently, I have resorted to 
> binary searches through the template: Comment out half the template and see 
> if it was the half causing the error. Keep halving the offending part until 
> you can isolate the line. 
>
> On Tue, Apr 4, 2023 at 5:16 PM wxstor...@gmail.com <wxstor...@gmail.com> 
> wrote:
>
>> I started getting an type error April 1st using days_ago. "Must be a real 
>> number, not str". But it is an integer that I am requesting from the 
>> database as I am requesting the raw dateTime. Now it works on some days and 
>> not others, like 357 days ago but not 360 days. Code from the template and 
>> the error is below. What am I missing here? 
>>
>> #set $n = 357
>>  <div class="card" >
>>             <h1><i class="fa-solid fa-clock-rotate-left" ></i> Last 
>> $days_ago($days_ago=$n).dateTime.raw </h1>
>>  </div>
>>
>> Apr  3 17:14:21 CW9009 weewx[618] INFO weewx.manager: Added record 
>> 2023-04-03 17:14:00 MDT (1680563640) to database 'weewx.sdb'
>> Apr  3 17:14:21 CW9009 weewx[618] INFO weewx.manager: Added record 
>> 2023-04-03 17:14:00 MDT (1680563640) to daily summary in 'weewx.sdb'
>> Apr  3 17:14:21 CW9009 weewx[618] INFO user.weatherflowudp: Listening for 
>> UDP broadcasts to IP address <broadcast> on port 50222, with timeout 60 and 
>> share_socket False...
>> Apr  3 17:14:22 CW9009 weewx[618] INFO weewx.restx: OWM: Published record 
>> 2023-04-03 17:14:00 MDT (1680563640)
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: 
>> Evaluation of template /etc/weewx/skins/Sofaskin/index.html.tmpl failed 
>> with exception '<class 'TypeError'>'
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: **** 
>> Ignoring template /etc/weewx/skins/Sofaskin/index.html.tmpl
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: **** 
>> Reason: must be real number, not str
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: **** 
>>  Traceback (most recent call last):
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****   
>>  File "/usr/share/weewx/weewx/cheetahgenerator.py", line 348, in generate
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****     
>>  unicode_string = compiled_template.respond()
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****   
>>  File "_etc_weewx_skins_Sofaskin_index_html_tmpl.py", line 1011, in respond
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****   
>>  File "/usr/share/weewx/weewx/cheetahgenerator.py", line 823, in filter
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****     
>>  filtered = six.text_type(val)
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****   
>>  File "/usr/share/weewx/weewx/tags.py", line 461, in __str__
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****     
>>  return str(vh)
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****   
>>  File "/usr/share/weewx/weewx/units.py", line 1019, in __str__
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****     
>>  s = self.toString()
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****   
>>  File "/usr/share/weewx/weewx/units.py", line 1012, in toString
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****     
>>  s = self.formatter.toString(self.value_t, self.context, addLabel=addLabel,
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****   
>>  File "/usr/share/weewx/weewx/units.py", line 698, in toString
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****     
>>  s = self._to_string(val_t, context, addLabel, useThisFormat, None_string, 
>> localize)
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****   
>>  File "/usr/share/weewx/weewx/units.py", line 774, in _to_string
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****     
>>  val_str = locale.format_string(format_string, val_t[0])
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****   
>>  File "/usr/lib/python3.9/locale.py", line 234, in format_string
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****     
>>  new_val.append(_format(perc.group(),
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****   
>>  File "/usr/lib/python3.9/locale.py", line 187, in _format
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: ****     
>>  formatted = percent % value
>> Apr  3 17:14:23 CW9009 weewx[618] ERROR weewx.cheetahgenerator: **** 
>>  TypeError: must be real number, not str
>> Apr  3 17:14:24 CW9009 weewx[618] INFO weewx.cheetahgenerator: Generated 
>> 10 files for report StandardReport in 2.68 seconds
>> Apr  3 17:14:26 CW9009 weewx[618] INFO weewx.imagegenerator: Generated 12 
>> images for report StandardReport in 2.18 seconds
>> Apr  3 17:14:26 CW9009 weewx[618] INFO weewx.reportengine: Copied 0 files 
>> to /var/www/html/weewx
>> Apr  3 17:14:34 CW9009 weewx[618] INFO weewx.reportengine: ftpgenerator: 
>> Ftp'd 23 files in 7.63 seconds
>>
>>
>> -- 
>> 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+...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/weewx-user/e01c712d-a053-43b8-a1d3-0e00bcb87391n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/e01c712d-a053-43b8-a1d3-0e00bcb87391n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/f46c67af-1898-4f7c-bdc8-7bf64cdee506n%40googlegroups.com.

Reply via email to