Speaking of which, and I may regret saying this, but I don't see any reason
why the filter on types acceptable to the accumulator can't be broadened to
include 'long'. If you add a long to an int, you get a long, without a
TypeError.

So, another alternative is to change the code from this:

if val is not None:
    # Check for non-numbers and for NaN
    if not isinstance(val, (float, int)) or val != val:
        raise ValueError("accum: ScalarStats.addHiLo expected float or int, "
                         "got type '%s' ('%s')" % (type(val), val))


to this:

if val is not None:
    # Check for non-numbers and for NaN
    if not isinstance(val, (float, int, long)) or val != val:
        raise ValueError("accum: ScalarStats.addHiLo expected float,
int, or long; "
                         "got type '%s' ('%s')" % (type(val), val))


NB: This will all be changing in V4, which will definitely allow longs (as
well as strings!).

-tk

On Fri, Oct 25, 2019 at 5:21 AM Thomas Keffer <tkef...@gmail.com> wrote:

> That would be the next step: instrument accum.py to show what's tripping
> it up.
>
> Matt, have you been successful in finding the 'long' data?
>
> -tk
>
> On Fri, Oct 25, 2019 at 3:47 AM gjr80 <gjroder...@gmail.com> wrote:
>
>> Tom,
>>
>> This is the second issue of this type I am aware of and whilst cmon was
>> the source for both, on the basis of the OP it appears they are from
>> different sources within cmon. As WeeWX can be fed with all manner of
>> sources is it worth a try..except in the add_value() method to catch the
>> ValueError and report the miscreant field?
>>
>> Gary
>>
>> On Friday, 25 October 2019 10:17:18 UTC+10, Thomas Keffer wrote:
>>>
>>> Hello,
>>>
>>> My best guess is that somewhere among the myriad of things that cmon
>>> measures is something that is of type 'long', but it's hard to say with
>>> only a small snippet of the log.
>>>
>>> Try running weewx directly from the command line, and watching the
>>> values go by. If something is of type long, it will be marked with an 'L'.
>>> E.g., 123456L.
>>>
>>> -tk
>>>
>>> On Thu, Oct 24, 2019 at 4:48 PM Matt Frost <matt....@gmail.com> wrote:
>>>
>>>> I upgraded to weewx 3.9.2 a few months back. Everything was fine for
>>>> awhile but then several weeks ago weewx started crashing. Here is what I
>>>> currently see:
>>>>
>>>> pi@weather:~ $ sudo /etc/init.d/weewx status
>>>> ● weewx.service - LSB: weewx weather system
>>>>    Loaded: loaded (/etc/init.d/weewx)
>>>>    Active: active (exited) since Wed 2019-10-23 17:27:22 CDT; 24h ago
>>>>   Process: 425 ExecStart=/etc/init.d/weewx start (code=exited,
>>>> status=0/SUCCESS)
>>>> Oct 24 09:05:15 weather weewx[758]: ****    File
>>>> "/usr/share/weewx/weewx/manager.py", line 1216, in _addSingleRecord
>>>> Oct 24 09:05:15 weather weewx[758]: ****
>>>> _day_summary.addRecord(record, weight=_weight)
>>>> Oct 24 09:05:15 weather weewx[758]: ****    File
>>>> "/usr/share/weewx/weewx/accum.py", line 260, in addRecord
>>>> Oct 24 09:05:15 weather weewx[758]: ****      func(self, record,
>>>> obs_type, add_hilo, weight)
>>>> Oct 24 09:05:15 weather weewx[758]: ****    File
>>>> "/usr/share/weewx/weewx/accum.py", line 318, in add_value
>>>> Oct 24 09:05:15 weather weewx[758]: ****
>>>> self[obs_type].addHiLo(val, record['dateTime'])
>>>> Oct 24 09:05:15 weather weewx[758]: ****    File
>>>> "/usr/share/weewx/weewx/accum.py", line 78, in addHiLo
>>>> Oct 24 09:05:15 weather weewx[758]: ****      "got type '%s' ('%s')" %
>>>> (type(val), val))
>>>> Oct 24 09:05:15 weather weewx[758]: ****  ValueError: accum:
>>>> ScalarStats.addHiLo expected float or int, got type '<type 'long'>'
>>>> ('3840714016')
>>>> Oct 24 09:05:15 weather weewx[758]: ****  Exiting.
>>>> pi@weather:~ $
>>>>
>>>> I found a couple of posts online regarding an issue in cmon that
>>>> sounded like the same issue I am seeing and applied these fixes:
>>>>
>>>>     456                         if k in self.last_net[iface]:
>>>>     457                             x = int(values[i]) -
>>>> self.last_net[iface][k]
>>>>     458                             if x < 0:
>>>>     459                                 maxcnt = 0x100000000 # 32-bit
>>>> counter
>>>>     460                                 if x + maxcnt < 0:
>>>>     461                                     maxcnt =
>>>> 0x10000000000000000 # 64-bit counter
>>>>     462                                 x += maxcnt
>>>>     463                                 if x > 2147483648:
>>>>     464                                     x = 2147483648
>>>>     465                             record['net_' + iface + '_' + k] =
>>>> int(x)
>>>>
>>>> Unfortunately I still have the same issue. weewx will run for a few
>>>> hours and crash again. Restarting weewx does not work I have to reboot my
>>>> pi to get weewx to start again and run for a few more hours.
>>>>
>>>> Any help is appreciated.
>>>>
>>>> --
>>>> 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...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/weewx-user/6fda9f5c-cf54-44e0-b5a3-547eede77d94%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/weewx-user/6fda9f5c-cf54-44e0-b5a3-547eede77d94%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/6aa05b54-fc25-442f-a356-3f86cf8859e8%40googlegroups.com
>> <https://groups.google.com/d/msgid/weewx-user/6aa05b54-fc25-442f-a356-3f86cf8859e8%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/CAPq0zEAWHvgnv4NyhGuyx_S%2Bi0Mm7qKE_T-1Nd67uHzfA470mg%40mail.gmail.com.

Reply via email to