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

On 12/12/25 12:12, vince wrote:
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.

On Friday, December 12, 2025 at 9:05:16 AM UTC-8 Danny Ciarniello wrote:

    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.

    On Friday, December 12, 2025 at 8:58:37 AM UTC-8 Pete Geenhuizen
    wrote:

        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

        On 12/12/25 10:14, '[email protected]' via weewx-user wrote:
        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 schrieb am Freitag, 12. Dezember 2025 um
        15:12:31 UTC+1:

            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


            On 12/11/25 16:01, vince wrote:
            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.

            On Thursday, December 11, 2025 at 11:02:19 AM UTC-8 Pete
            Geenhuizen wrote:

                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


                On 12/9/25 16:30, Danny Ciarniello wrote:
                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.

                On Tuesday, December 9, 2025 at 12:48:44 PM UTC-8
                vince wrote:

                    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}"
                                        )

                    But around line 222 (much different) in
                    
https://github.com/uajqq/weewx-belchertown-new/blob/master/bin/user/belchertown.py
                    I see:

                                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 ?

                    On Tuesday, December 9, 2025 at 11:47:26 AM
                    UTC-8 Pete Geenhuizen wrote:

                        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


                        On 12/9/25 12:40, vince wrote:
                        "/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.

                        On Tuesday, December 9, 2025 at 8:23:25 AM
                        UTC-8 Pete Geenhuizen wrote:

                            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

-- 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].
                        To view this discussion visit
                        
https://groups.google.com/d/msgid/weewx-user/22eccf9d-e3f5-4345-9da5-481f0451d17bn%40googlegroups.com
                        
<https://groups.google.com/d/msgid/weewx-user/22eccf9d-e3f5-4345-9da5-481f0451d17bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

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


-- 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].
                To view this discussion visit
                
https://groups.google.com/d/msgid/weewx-user/122a7232-eda2-441b-8d1e-caf3e59c0cc6n%40googlegroups.com
                
<https://groups.google.com/d/msgid/weewx-user/122a7232-eda2-441b-8d1e-caf3e59c0cc6n%40googlegroups.com?utm_medium=email&utm_source=footer>.

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

-- 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].
            To view this discussion visit
            
https://groups.google.com/d/msgid/weewx-user/9152e81d-b589-4b3a-89de-5a4f57c12645n%40googlegroups.com
            
<https://groups.google.com/d/msgid/weewx-user/9152e81d-b589-4b3a-89de-5a4f57c12645n%40googlegroups.com?utm_medium=email&utm_source=footer>.

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

-- 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].
        To view this discussion visit
        
https://groups.google.com/d/msgid/weewx-user/92a04861-b46c-4bdb-8e6b-a69d52fecb09n%40googlegroups.com
        
<https://groups.google.com/d/msgid/weewx-user/92a04861-b46c-4bdb-8e6b-a69d52fecb09n%40googlegroups.com?utm_medium=email&utm_source=footer>.

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

--
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]. To view this discussion visit https://groups.google.com/d/msgid/weewx-user/056fdef0-9436-4820-8e6e-e86cfbc19435n%40googlegroups.com <https://groups.google.com/d/msgid/weewx-user/056fdef0-9436-4820-8e6e-e86cfbc19435n%40googlegroups.com?utm_medium=email&utm_source=footer>.

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

--
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].
To view this discussion visit 
https://groups.google.com/d/msgid/weewx-user/9938ef82-e507-4891-893f-3e30aecb40b8%40gmail.com.

Reply via email to