Roger that. What would be the best way for me to debug this ? Do you have a setup to recommend. It’s been my main issue debugging this python in Weewx. Since my knowledge lacks in debugging a linux environment I`ve been looking mostly at the logs of weewx but surely you must have some kind of setup or debugger you can attach to the process and see variables and do a step by step ?
Thank. From: weewx-user@googlegroups.com <weewx-user@googlegroups.com> On Behalf Of Tom Keffer Sent: May 6, 2020 12:27 To: weewx-user <weewx-user@googlegroups.com> Subject: Re: [weewx-user] Issue with a report last values are Zero At first glance, I'd say this is an "off-by-one <https://en.wikipedia.org/wiki/Off-by-one_error> " problem, but there's way too much for me to debug. It's also as a screenshot, so I can't even look at it in an editor. Sorry. I would suggest running it with a good debugger, or using lots of print() statements, to figure out where its getting its values. On Wed, May 6, 2020 at 9:07 AM Hyrules <hyru...@gmail.com <mailto:hyru...@gmail.com> > wrote: from __future__ import with_statement from importlib import reload import datetime import time import calendar import json import os import os.path import syslog import sys import locale import weewx import weecfg import configobj import weedb import weeutil.weeutil import weewx.reportengine import weewx.station import weewx.units import weewx.tags import weewx.uwxutils from collections import OrderedDict from weewx.cheetahgenerator import SearchList from weewx.tags import TimespanBinder from weeutil.weeutil import to_bool, TimeSpan, to_int, archiveDaySpan, archiveWeekSpan, archiveMonthSpan, archiveYearSpan, startOfDay, timestamp_to_string, option_as_list try: from weeutil.config import search_up except: # Pass here because chances are we have an old version of weewx which will get caught below. pass # Check weewx version. Many things like search_up, weeutil.weeutil.KeyDict (label_dict) are from 3.9 if weewx.__version__ < "3.9": raise weewx.UnsupportedFeature("weewx 3.9 and newer is required, found %s" % weewx.__version__) def logmsg(level, msg): syslog.syslog(level, 'Hydrometeo Extension: %s' % msg) def logdbg(msg): logmsg(syslog.LOG_DEBUG, msg) def loginf(msg): logmsg(syslog.LOG_INFO, msg) def logerr(msg): logmsg(syslog.LOG_ERR, msg) # Print version in syslog for easier troubleshooting VERSION = "0.1" loginf("version %s" % VERSION) class ExtraStats(SearchList): def __init__(self, generator): SearchList.__init__(self, generator) def get_extension_list(self, timespan, db_lookup): alltime = TimespanBinder(timespan, db_lookup, formatter=self.generator.formatter, converter=self.generator.converter, skin_dict= self.generator.skin_dict) last2days = self.make_download_data(1, db_lookup) last7days = self.make_download_data(7, db_lookup) search_list_extension = {'last2days' : last2days, 'last7days' : last7days, 'alltime' : alltime} return [search_list_extension] def make_download_data(self, numberofdays, db_lookup): ts_end = datetime.datetime.now() ts_start = datetime.datetime.now() - datetime.timedelta(days=numberofdays) ts_start = ts_start.replace(hour=00, minute=15, second=00,microsecond=00) tsb = TimespanBinder(TimeSpan(time.mktime(ts_start.timetuple()), time.mktime(ts_end.timetuple())), db_lookup,formatter=self.generator.formatter, converter=self.generator.converter, skin_dict= self.generator.skin_dict) spans = tsb.spans(interval=900) return spans This code generates last2days -- 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 <mailto:weewx-user+unsubscr...@googlegroups.com> . To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/973a62ae-07c2-4719-9a9f-a3a6fd790aea%40googlegroups.com <https://groups.google.com/d/msgid/weewx-user/973a62ae-07c2-4719-9a9f-a3a6fd790aea%40googlegroups.com?utm_medium=email&utm_source=footer> . -- You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/MFnpwI8sGNQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscr...@googlegroups.com <mailto:weewx-user+unsubscr...@googlegroups.com> . To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEDzDBetcyTH30OCjkSV1Y45_See0dDwxonf5gzBWh97qg%40mail.gmail.com <https://groups.google.com/d/msgid/weewx-user/CAPq0zEDzDBetcyTH30OCjkSV1Y45_See0dDwxonf5gzBWh97qg%40mail.gmail.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/001801d623c3%24ebbb16b0%24c3314410%24%40gmail.com.