Belchertown v1.6 error

168 views
Skip to first unread message

Pete Geenhuizen

unread,
Dec 9, 2025, 11:23:25 AM (8 days ago) Dec 9
to weewx...@googlegroups.com
I trying to update my Rock 8 weewx v4 to Rocky 9 weewx v5 using the new
1.6 forked version of the Belchertown skin.

I'm testing this out in simulator mode, and it sees to start fine until
it does an update which start with this error

ERROR weewx.reportengine: Caught unrecoverable exception in generator
'weewx.cheetahgenerator.CheetahGenerator'

ERROR weewx.reportengine:         ****  f-string: unmatched '['
(belchertown.py, line 244)

and goes down hill from there

Attached is a copy of the last run..

I have very  limited programming skills and zero knowledge of python, so
I'm hoping that someone help me fix the problem.

Thanks

Pete




--
Unencumbered by the thought process.
-- Click and Clack the Tappet brothers
belchertown-error

salinois

unread,
Dec 9, 2025, 12:13:01 PM (8 days ago) Dec 9
to weewx...@googlegroups.com
hello,

I don't try again this version; where have you donwloaded it ?

put here the file belchertown.py.

Patrick

vince

unread,
Dec 9, 2025, 12:40:25 PM (8 days ago) Dec 9
to weewx-user
"using the new 1.6 forked version of the Belchertown skin" - without knowing 'which' forked version it might be difficult for people to help.

How about running "weectl debug" and attaching the output so folks can see your setup....

Based on the error you mention, best guess is you have [ something ] with a mismatched number of [ and ] brackets.

Pete Geenhuizen

unread,
Dec 9, 2025, 2:46:53 PM (8 days ago) Dec 9
to weewx...@googlegroups.com, salinois
Here ya go, and I hope that it's an easy fix.
Thanks
Pete
belchertown.py

Pete Geenhuizen

unread,
Dec 9, 2025, 2:47:26 PM (8 days ago) Dec 9
to weewx...@googlegroups.com, vince
I downloaded the v1.6 skin from here https://github.com/uajqq/weewx-belchertown-new.  
Attached is the output from weectl.debug
Thanks for your help.
Pete

--
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 visit https://groups.google.com/d/msgid/weewx-user/22eccf9d-e3f5-4345-9da5-481f0451d17bn%40googlegroups.com.
weectl.debug-output

vince

unread,
Dec 9, 2025, 3:48:44 PM (8 days ago) Dec 9
to weewx-user
Your weewx.conf works ok versus the uajqq version in github, but the belchertown.py that you uploaded here looks like it's not that version.

In the belchertown.py skin you uploaded line 244 is the locale error
               if belchertown_debug:
                    log.error(
                        f"Locale: Error using locale {self.generator.skin_dict["Extras"]["belchertown_locale"]}. "
                        f"This locale may not be installed on your system and you may see unexpected results. "
                        f"Belchertown skin JavaScript will try to use this locale. Full error: %{error}"
                    )



                if belchertown_debug:
                    log.error(
                        f"Error using locale {belchertown_locale}. "
                        "This locale may not be installed on your system and you may see unexpected results. "
                        f"Python could not set the requested locale, but Belchertown skin JavaScript will attempt to use the provided locale string. Full error: {error}"
                    )

So my wild guess is you have some hacked/previous/miscellaneous/unknown version of the forked skin.  Perhaps try installing the real one ?

Danny Ciarniello

unread,
Dec 9, 2025, 4:30:08 PM (8 days ago) Dec 9
to weewx-user
The uploaded version of belchertown.py looks like the one that comes with the v1.6 release.  That version had a number of issues that have since been fixed.  Replacing belchertown.py with the one vince pointed to should, hopefully, fix the problem.

Pete Geenhuizen

unread,
Dec 11, 2025, 2:02:19 PM (6 days ago) Dec 11
to weewx...@googlegroups.com, Danny Ciarniello

I downloaded v1.6 several days ago so I guess since then some additional fixes were done, anyway I replaced belchertown.py with the one listed here ad that solved that problem.

Once I had everything working I decided to test the configuration by copying over my existing database with 11 years of observations to ensure that once I attached my weather station everything wold work seamlessly, however that is not to be, I now get this error


I'm testing this new installation in simulator mode, and have copied my existing database file with, 11 years of observations which I would hate to loose, over to test that everything is working, but unfortunately am now getting this error.

Now when I start up weewx I get this database error, more info in the attached log

Dec 10 08:56:20 localhost weewxd[1246977]: INFO weewx.engine: Main loop exiting. Shutting engine down.
Dec 10 08:56:20 localhost weewxd[1246977]: INFO weewx.engine: Shutting down StdReport thread
Dec 10 08:56:40 localhost weewxd[1246977]: ERROR weewx.engine: Unable to shut down StdReport thread
Dec 10 08:56:40 localhost weewxd[1246977]: CRITICAL __main__: Database OperationalError exception: database is locked
Dec 10 08:56:40 localhost weewxd[1246977]: CRITICAL __main__:     ****  Waiting 2 minutes then retrying...
Dec 10 08:56:41 localhost weewxd[1246977]: INFO weewx.cheetahgenerator: Generated 12 files for report SeasonsReport in 145.34 seconds

I found some suggestions on line to fix this but none have worked.

Thanks

Pete

weewx-db-errors
Message has been deleted

vince

unread,
Dec 11, 2025, 4:01:11 PM (6 days ago) Dec 11
to weewx-user
Try 2 - google groups deleted my previous reply for unknown reasons.

If you have 11 years of old data you likely have the original old wview compatible schema so I'd recommend you convert your db to the new wview_extended schema and rebuild-daily.  There are lots of threads here with how to do that using 'weectl database'.  In particular, Belchertown needs a few elements missing from the old schema.  While you can add them each manually, it's (to me) easier to just upgrade the db and not need to worry it.  Regardless, you'll need to rebuild-daily afterward to build the summary tables.

Seasons and Belchertown each have their own NOAA trees that need to be generated one time on first startup if you didn't pre-seed your output HTML tree with previously generated files.  That can take some time, once.  Seasons typically is lightning fast once this is done, so if it took 145 seconds the first time, this might have been why.  It should speed up after the NOAA files for your old data have been generated.

Pete Geenhuizen

unread,
Dec 12, 2025, 9:12:31 AM (5 days ago) Dec 12
to weewx...@googlegroups.com, vince

First off, I know absolutely nothing about databases and haven't install anything related to a database, up to  now.

Using Thomas' instructions from https://github.com/weewx/weewx/wiki/Switching-to-the-new-wview_extended-schema

# mysql command not found, 

so I installed mysql-8.0.43-1.el9_6.x86_64

when I run the command

# mysql> GRANT select, update, create, delete, insert ON weewx_new.* TO weewx@localhost;

I ended up with a file called GRANT, but not weewx.sdb_new

So I guess that I'm completely out of my depth with not a clue what to do next.

Any pointers on what to do next would be greatly appreciated.

Pete

michael.k...@gmx.at

unread,
Dec 12, 2025, 10:14:29 AM (5 days ago) Dec 12
to weewx-user
You won't have any success using mysql for querying a sqlite database, so first things first: what kind of database are you using with WeeWX?

Pete Geenhuizen

unread,
Dec 12, 2025, 11:58:37 AM (5 days ago) Dec 12
to weewx...@googlegroups.com

I started out with wview and switched over to weewx many years ago and used whatever the default database was and because it worked just continued to use the same data file and until now I guess didn't worry about any changes in the structure.

Now that I'm moving from Rocky 8  to Rocky 9 I now need to install weewx v5.  I would have to loose the 14 years of data that I already have, so I'd like to keep it if at all possible

from weewx.conf

   This section defines various databases.

[Databases]

    # A SQLite database is simply a single file.
    [[archive_sqlite]]
        database_name = weewx-lc.sdb
        database_type = SQLite

# file weewx-lc.sdb
weewx-lc.sdb: SQLite 3.x database, last written using SQLite version 3034001

So how can/do I upgrade the data to be compatible with v5?

Thanks

Pete

Danny Ciarniello

unread,
Dec 12, 2025, 12:05:16 PM (5 days ago) Dec 12
to weewx-user
Instructions for switching to the new schema are in https://github.com/weewx/weewx/wiki/Switching-to-the-new-wview_extended-schema.

Since you're using SQLite, ignore anything related to MySQL.

vince

unread,
Dec 12, 2025, 12:12:49 PM (5 days ago) Dec 12
to weewx-user
Pete - this came up only 7 days ago in an extended thread.   See https://groups.google.com/g/weewx-user/c/6zJCXEte-js/m/eSITjnCwCAAJ for the howto.   Be sure to copy your existing db and work off a temporary copy while doing this just in case.

Pete Geenhuizen

unread,
Dec 12, 2025, 12:49:48 PM (5 days ago) Dec 12
to weewx...@googlegroups.com

Oops my bad, didn't do a reply all

 

Vince,

Seems that this just seems to go from worse to bad.

weectl database reconfigure
Using configuration file /etc/weewx/weewx.conf
Copying database 'weewx-lc.sdb' to 'weewx-lc.sdb_new'
The new database will use the same unit system as the old ('US').
Are you sure you wish to proceed (y/n)? y
Traceback (most recent call last):
  File "/usr/share/weewx/weectl.py", line 75, in <module>
    main()
  File "/usr/share/weewx/weectl.py", line 67, in main
    namespace.func(namespace)
  File "/usr/share/weewx/weectllib/__init__.py", line 90, in dispatch
    namespace.action_func(config_dict, namespace)
  File "/usr/share/weewx/weectllib/database_cmd.py", line 371, in reconfigure_database
    weectllib.database_actions.reconfigure_database(config_dict,
  File "/usr/share/weewx/weectllib/database_actions.py", line 295, in reconfigure_database
    weewx.manager.reconfig(manager_dict['database_dict'],
  File "/usr/share/weewx/weewx/manager.py", line 711, in reconfig
    record_generator = weewx.units.GenWithConvert(old_archive.genBatchRecords(),
UnboundLocalError: local variable 'weewx' referenced before assignment

 I sure do hate that this is happening!

Thanks

Pete

vince

unread,
Dec 12, 2025, 1:00:40 PM (5 days ago) Dec 12
to weewx-user
There was a previous thread here with that too. It’s a bug. If your client works replace manager.py with the current one in the github repo it will work.


and just drop it into place over the one you have from 5.2

vince

unread,
Dec 12, 2025, 1:03:32 PM (5 days ago) Dec 12
to weewx-user
Apologies.  That third sentence is 'not' what I typed. I have no idea why Google is once again silently altering what I type after I post.  Super annoying.

All you need to do is overwrite manager.py with the to-be-released copy in the link I mentioned.  Then try again and it'll work.

Pete Geenhuizen

unread,
Dec 12, 2025, 3:25:29 PM (5 days ago) Dec 12
to weewx...@googlegroups.com, vince

Vince,

Thanks for your help patience and suggestions they all worked and it's now updating and working error free.

Pete

Reply all
Reply to author
Forward
0 new messages