weewx 5.0 upgrade trouble

227 views
Skip to first unread message

Frank Frommelt

unread,
Nov 21, 2023, 6:26:05 AM11/21/23
to weewx-user
Hi there,

OK, I have taken the risk in updatting weewx from 4.10.2 to the latest 5.0 (beta) version.

I followed the update guide and everything looked fine.

When finally starting the service I am getting the following error:

Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****  TypeError: can't subtract offset-naive and offset-aware datetimes

So, it looks like some data is time-zone aware and some is not.

Basically I found something to cure the problem, but as I have no idea on programming, I need some help...



Here is the full log down to the error message... 

(weewx-venv) pi@raspi:/home/weewx $ sudo systemctl start weewx
(weewx-venv) pi@raspi:/home/weewx $ tail -f /var/log/weewx.log
Nov 21 12:03:48 raspi weewx[18165] INFO user.mqtt: binding to archive
Nov 21 12:03:48 raspi weewx[18165] INFO user.mqtt: topic is weather
Nov 21 12:03:48 raspi weewx[18165] INFO user.mqtt: desired unit system is METRIC
Nov 21 12:03:48 raspi weewx[18165] INFO user.mqtt: data will be uploaded to mqtt://weewx:x...@192.168.1.140:1883
Nov 21 12:03:48 raspi weewx[18165] INFO weewx.engine: 'pyephem' detected, extended almanac data is available
Nov 21 12:03:48 raspi weewx[18165] INFO __main__: Starting up weewx version 5.0.0b15
Nov 21 12:03:48 raspi weewx[18165] INFO weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb'
Nov 21 12:03:48 raspi weewx[18165] INFO weewx.manager: Starting backfill of daily summaries
Nov 21 12:03:48 raspi weewx[18165] INFO weewx.manager: Daily summaries up to date
Nov 21 12:03:49 raspi weewx[18165] INFO weewx.drivers.fousb: synchronising to the weather station (quality=0)
Nov 21 12:03:52 raspi weewx[18165] INFO weewx.engine: Main loop exiting. Shutting engine down.
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__: Caught unrecoverable exception:
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****  can't subtract offset-naive and offset-aware datetimes
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****  Traceback (most recent call last):
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****    File "/home/pi/weewx-venv/lib/python3.9/site-packages/weewxd.py", line 157, in main
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****      engine.run()
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****    File "/home/pi/weewx-venv/lib/python3.9/site-packages/weewx/engine.py", line 175, in run
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****      self.dispatchEvent(weewx.Event(weewx.STARTUP))
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****    File "/home/pi/weewx-venv/lib/python3.9/site-packages/weewx/engine.py", line 242, in dispatchEvent
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****      callback(event)
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****    File "/home/pi/weewx-venv/lib/python3.9/site-packages/weewx/engine.py", line 581, in startup
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****      self._catchup(self.engine.console.genStartupRecords)
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****    File "/home/pi/weewx-venv/lib/python3.9/site-packages/weewx/engine.py", line 694, in _catchup
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****      for record in generator(lastgood_ts):
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****    File "/home/pi/weewx-venv/lib/python3.9/site-packages/weewx/drivers/fousb.py", line 1094, in genArchiveRecords
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****      records = self.get_records(since_ts)
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****    File "/home/pi/weewx-venv/lib/python3.9/site-packages/weewx/drivers/fousb.py", line 1303, in get_records
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****      dts, ptr = self.sync(read_period=fixed_block['read_period'])
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****    File "/home/pi/weewx-venv/lib/python3.9/site-packages/weewx/drivers/fousb.py", line 1380, in sync
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****      if last_date - prev_date > datetime.timedelta(seconds=50):
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****  TypeError: can't subtract offset-naive and offset-aware datetimes
Nov 21 12:03:52 raspi weewx[18165] CRITICAL __main__:     ****  Exiting.

Tom Keffer

unread,
Nov 21, 2023, 8:51:17 AM11/21/23
to weewx...@googlegroups.com
This is a problem with the Fine Offset driver that we're aware of. It's caused by the deprecation of the function datetime.utcnow() in Python 3.12.

The fix for now is to downgrade to Python 3.11.

-tk

--
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/905eb6cb-ebf0-4e70-8dd1-279db3a47750n%40googlegroups.com.

Frank Frommelt

unread,
Nov 21, 2023, 4:16:53 PM11/21/23
to weewx...@googlegroups.com, Tom Keffer
Hi Tom, 
thanks for that tip. 
I managed to downgrade to 4.10.2 in the meantime to re-gain my weather station. 
I will try your workaround next weekend. 
Take care 
   Frank 

--- Original Nachricht ---
Von: Tom Keffer tke...@gmail.com
Datum: 21. November 2023 14:51:33
An: weewx...@googlegroups.com
Betreff: Re: [weewx-user] weewx 5.0 upgrade trouble

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/52Woq03XVoM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEA93Sv3vSDzVTWmWDJYiWY%3DMa3h9ZdaYtqFPrK8U3Uttw%40mail.gmail.com.

Tom Keffer

unread,
Nov 21, 2023, 4:20:02 PM11/21/23
to Frank Frommelt, weewx...@googlegroups.com
v4.10.2 will have the same problem. It's Python 3.12 that's causing the problem. 

Frank Frommelt

unread,
Nov 22, 2023, 1:24:09 AM11/22/23
to Tom Keffer, weewx...@googlegroups.com
Hmm, after downgrading back to 4.10.2 everything is running smooth as before. 
I guess the virtual env. for 5.0 is running a different python version as 4.10.2


--- Original Nachricht ---
Von: Tom Keffer tke...@gmail.com
Datum: 21. November 2023 22:19:57
An: Frank Frommelt f.fro...@gmail.com
CC: weewx...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages