Just like 'month' and 'day', you have to supply a value for 'year' in the interpolation dictionary on line 90.
Or, alternatively, you have to supply 'time_a_year_ago'. On Fri, Apr 24, 2020 at 4:40 PM rich T <[email protected]> wrote: > Thanks for looking into this and know it was an untested solution. > > The following statement gives me this error: > "SELECT SUM(`wsum`), SUM(`sumtime`) FROM {table}_day_{obs_type} " > "WHERE STRFTIME('%m-%d', dateTime, 'unixepoch','localtime') = > '{month:02d}-{day:02d}' " > "AND STRFTIME('%Y', dateTime, 'unixepoch','localtime') < {year:04d};" > > Apr 24 19:11:17 raspberrypi weewx[1224] INFO weewx.manager: Added record > 2020-04-24 19:10:00 EDT (1587769800) to database 'weewx.sdb' > Apr 24 19:11:17 raspberrypi weewx[1224] INFO weewx.manager: Added record > 2020-04-24 19:10:00 EDT (1587769800) to daily summary in 'weewx.sdb' > Apr 24 19:11:17 raspberrypi weewx[1224] DEBUG weewx.reportengine: > reportengine: Running reports for latest time in the database. > Apr 24 19:11:17 raspberrypi weewx[1224] DEBUG weewx.reportengine: > reportengine: Running report 'SeasonsReport' > Apr 24 19:11:18 raspberrypi weewx[1224] DEBUG weewx.reportengine: > reportengine: Found configuration file /home/weewx/skins/Seasons/skin.conf > for report 'SeasonsReport' > Apr 24 19:11:18 raspberrypi weewx[1224] DEBUG weewx.cheetahgenerator: > Using search list ['weewx.cheetahgenerator.Almanac', > 'weewx.cheetahgenerator.Station', 'weewx.cheetahgenerator.Current', > 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo', > 'weewx.cheetahgenerator.Extras'] > Apr 24 19:11:18 raspberrypi weewx[1224] DEBUG weewx.manager: Daily summary > version is 2.0 > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > Generate failed with exception '<class 'KeyError'>' > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: **** > Ignoring template /home/weewx/skins/Seasons/index.html.tmpl > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: **** > Reason: 'year' > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** Traceback (most recent call last): > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** File "/home/weewx/bin/weewx/cheetahgenerator.py", line 322, in > generate > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** unicode_string = compiled_template.respond() > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** File "_home_weewx_skins_Seasons_index_html_tmpl.py", line 225, in > respond > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line > 1707, in _handleCheetahInclude > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** self._CHEETAH__cheetahIncludes[_includeID].respond(trans) > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** File "_home_weewx_skins_Seasons_historical_statistics_inc.py", line > 338, in respond > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** File "/home/weewx/bin/weewx/tags.py", line 347, in __getattr__ > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** return self._do_query(aggregate_type) > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** File "/home/weewx/bin/weewx/tags.py", line 364, in _do_query > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** db_manager, val=val, **self.option_dict) > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** File "/home/weewx/bin/weewx/xtypes.py", line 102, in get_aggregate > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** **option_dict) > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** File "/home/weewx/bin/user/historical.py", line 99, in get_aggregate > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** sql_stmt = > Historical.sql_stmts[dbtype][aggregate_type].format(**interp_dict) > Apr 24 19:11:22 raspberrypi weewx[1224] ERROR weewx.cheetahgenerator: > **** KeyError: 'year' > Apr 24 19:11:24 raspberrypi weewx[1224] INFO weewx.cheetahgenerator: > Generated 7 files for report SeasonsReport in 5.92 secondsEnter code here > ... > > The following statement gives me this error: > > Apr 24 19:30:28 raspberrypi weewx[2847] DEBUG weewx.manager: Daily summary > version is 2.0 > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > Generate failed with exception '<class 'KeyError'>' > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: **** > Ignoring template /home/weewx/skins/Seasons/index.html.tmpl > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: **** > Reason: 'time_a_year_ago' > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** Traceback (most recent call last): > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** File "/home/weewx/bin/weewx/cheetahgenerator.py", line 322, in > generate > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** unicode_string = compiled_template.respond() > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** File "_home_weewx_skins_Seasons_index_html_tmpl.py", line 225, in > respond > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line > 1707, in _handleCheetahInclude > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** self._CHEETAH__cheetahIncludes[_includeID].respond(trans) > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** File "_home_weewx_skins_Seasons_historical_statistics_inc.py", line > 338, in respond > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** File "/home/weewx/bin/weewx/tags.py", line 347, in __getattr__ > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** return self._do_query(aggregate_type) > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** File "/home/weewx/bin/weewx/tags.py", line 364, in _do_query > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** db_manager, val=val, **self.option_dict) > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** File "/home/weewx/bin/weewx/xtypes.py", line 102, in get_aggregate > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** **option_dict) > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** File "/home/weewx/bin/user/historical.py", line 99, in get_aggregate > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** sql_stmt = > Historical.sql_stmts[dbtype][aggregate_type].format(**interp_dict) > Apr 24 19:30:30 raspberrypi weewx[2847] ERROR weewx.cheetahgenerator: > **** KeyError: 'time_a_year_ago'Enter code here... > > Rich > > -- > You received this message because you are subscribed to the Google Groups > "weewx-development" 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-development/99b9a769-3cbe-442d-98fc-3f723a0e89c8%40googlegroups.com > <https://groups.google.com/d/msgid/weewx-development/99b9a769-3cbe-442d-98fc-3f723a0e89c8%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "weewx-development" 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-development/CAPq0zEBGxevHP6Z%3DtjoPxNHQaqA%2BiNXWQdiGcAuMxton7aXMyw%40mail.gmail.com.
