default value for WEEWX_ROOT: works for storing data, not for skin

33 views
Skip to first unread message

Greg Troxel

unread,
Dec 22, 2025, 2:00:51 PM (3 days ago) Dec 22
to weewx...@googlegroups.com
My setup:

NetBSD 9 earmv7hf-el (RPI3)
Vantage Pro2 serial logger

weewx 5.1.0 (yes, I know that's old; trying to understand/minimize
before upgrading)

Modified Standard skin (remove some things, rearrange html, but
nothing really serious)

rsync of generated html to another machine

MQTT extension, archive only, json dictionary, read by Home Assistant

and in particular

weewx installed in the system python directory as a package

$HOME/weewx-data is my root directory, and contains weewx.conf and skins

$HOME/weewx-data/archive/weewx.sdb is my (sqlite3) archive file

weewx invoked by a script that waits for NTP sync, and then
cd /home/gdt/weewx-data
weewxd-3.12 weewx.conf

For a long time I have had in my weewx.conf

# \todo Why is this not in the example? Why is it needed?
WEEWX_ROOT=/home/gdt/weewx-data

and everything works fine.

So, I removed that line, and restarted.

My archive file is getting updated every 5 minutes as expected.
HA is seeing fresh weather data via MQTT 15s after the archive time,
also expected by those who read the VP2 code.
The reports are failing. In the logs:

Dec 22 13:07:16 wx root: weewx-wait stratum ok 127.0.0.1: stratum 4, offset 0.000054, synch distance 0.076792
Dec 22 13:10:16 wx -: weewxd[161]: ERROR weewx.reportengine: Caught unrecoverable exception in generator 'weewx.cheetahgenerator.CheetahGenerator'
Dec 22 13:10:16 wx -: weewxd[161]: ERROR weewx.reportengine: **** Attempt to open a non-existent database archive/weewx.sdb
Dec 22 13:10:16 wx -: weewxd[161]: ERROR weewx.reportengine: **** Traceback (most recent call last):
Dec 22 13:10:16 wx -: weewxd[161]: ERROR weewx.reportengine: **** File "/usr/pkg/lib/python3.12/site-packages/weewx/reportengine.py", line 248, in run
Dec 22 13:10:16 wx -: weewxd[161]: ERROR weewx.reportengine: **** obj.start()
Dec 22 13:10:16 wx -: weewxd[161]: ERROR weewx.reportengine: **** File "/usr/pkg/lib/python3.12/site-packages/weewx/reportengine.py", line 465, in start
Dec 22 13:10:16 wx -: weewxd[161]: ERROR weewx.reportengine: **** self.run()

I then -- while in that directory -- did

$ /usr/pkg/bin/weectl-3.12 report run PublicReport

and it's cranking away producing NOAA summaries (I use RAM /tmp for html
output, trading off having to recreate NOAA files on boot for
reduced uSD wear).

I reran the report command above while in $HOME, not $HOME/weewx-data,
and it ran.

Reading the docs at https://www.weewx.com/docs/5.2/usersguide/where/ it
says that (for pip) the default value of WEEWX_ROOT is ~/weewx-data/
(not sure why there's a trailing slash). So not setting it should be
equivalent.

It seems like report generation as invoked after archive interval
processing is not in the right directory, or not in such a way that it
inherits WEEWX_ROOT.

So, I'll put it back, and then proceed to ugprading to 5.2.0, but I
wonder if this is a known issue, or really if I'm confused.

vince

unread,
Dec 22, 2025, 2:46:42 PM (3 days ago) Dec 22
to weewx-user
Your StdReport and DatabaseTypes sections use relative pathnames based on WEEWX_ROOT being expected.

https://www.weewx.com/docs/5.2/upgrade/?h=weewx_root#weewx_root-is-now-relative-to-the-configuration-file has a non-breaking change in that area.  Guessing a 5.2 upgrade might solve your issue since WEEWX_ROOT is optional in 5.2 now.  I left it in my .conf files anyway, FWIW.

Greg Troxel

unread,
Dec 22, 2025, 7:59:38 PM (3 days ago) Dec 22
to vince, weewx-user
vince <vince...@gmail.com> writes:

> Your StdReport and DatabaseTypes sections use relative pathnames based on
> WEEWX_ROOT being expected.

Or having a value. But the exception was reading the database.

> https://www.weewx.com/docs/5.2/upgrade/?h=weewx_root#weewx_root-is-now-relative-to-the-configuration-file has
> a non-breaking change in that area. Guessing a 5.2 upgrade might solve
> your issue since WEEWX_ROOT is optional in 5.2 now. I left it in my .conf
> files anyway, FWIW.

Great hint, thanks. Looking back, that upgrade text is in 5.1 at least
and I think 5.0. So what I am doing should work.

I updated from python 3.12 to 3.13, and then to 5.2.0 (upgraded pkgsrc
package, and then applied the diff from 5.1.0 to 5.2.0 to weewx.conf and
to my skin). All worked ok.

After that, I removed the setting of WEEWX_ROOT and now everything
works.

So the new "WEEWX_ROOT defaults to the dir that has the config" works
fine in 5.2.0 and a has a minor bug in 5.1.0, I now believe.
Reply all
Reply to author
Forward
0 new messages