On Saturday, 16 March 2019 11:11:10 UTC-3, Peter Hurn wrote:
>
> Unfortunately despite adding the integer to the line in cmon.py in my 
> /use/share/weewx/user folder I am still getting the following error, any 
> ideas?
>
... 

> Feb 14 11:10:15 pi21 vpro[28175]:     ****  ValueError: accum: 
>> ScalarStats.addHiLo expected float or int, got 3392911048
>>
>
Hii Peter,

The maximum positive value for an int in Python 2 is 2147483648 (2^31). The 
value at the time of the crash is bigger (3392911048), so this value is 
still a long integer.
Such big numbers should only occur if you have very heavy network traffic 
and/or a long archive period.

A quick-and-dirty workaround might be to preset the value of x to maxint in 
case it is bigger, like (not tested):
                        if k in self.last_net[iface]:
                            x = int(values[i]) - self.last_net[iface][k]
                            if x < 0:
                                maxcnt = 0x100000000 # 32-bit counter
                                if x + maxcnt < 0:
                                    maxcnt = 0x10000000000000000 # 64-bit 
counter
                                x += maxcnt
if x > 2147483648:
    x = 2147483648
                            record['net_' + iface + '_' + k] = int(x)
                        self.last_net[iface][k] = int(values[i])

Luc

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to