schema = schemas.wview_extended.schema
⊣GE⊢

> On 28 Nov 2025, at 6:32 am, Dr__Bob <[email protected]> wrote:
> 
> Tom,
> I'm glad I found this thread.  I just did a rather (I thought) 
> straight-forward reconfigure of my database.  I had the ancient wview schema, 
> and I wanted to update to the wview_extended, since I installed Rich's 
> MQTTSubscribe to get co2, pm2.5 and pm10 values from my Qingping Air Monitor 
> Lite.  Anyway, I got the following error:
> 
>  weectl database reconfigure
> Using configuration file /etc/weewx/weewx.conf
> Copying database 'weewx.sdb' to 'weewx.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: cannot access local variable 'weewx' where it is not 
> associated with a value
> 
> All I did was change the schema in my weewx.conf from 
> 
>         schema = schemas.wview.schema
> to
> 
>         schema = weewx.schemas.wview_extended.schema
> 
> I dropped in your new manager.py and it worked.
> On Monday, November 3, 2025 at 1:18:18 PM UTC-8 Tom Keffer wrote:
>> I was able to reproduce this. It's an interesting bug. If a schema is named, 
>> then the import of "weewx.schemas" is never done, so the package "weewx" 
>> will not be defined. Replace your copy of /usr/share/weewx/weewx/manager.py 
>> with the attached version and give it another try. 
>> 
>> -tk
>> 
>> 
>> 
>> On Mon, Nov 3, 2025 at 10:05 AM 'Werner Krenn' via weewx-user 
>> <[email protected] <>> wrote:
>>> WeeWx 5.2.0:
>>> I'm trying to convert a database from "US" to "METRICWX", but I'm getting 
>>> this error message:
>>> 
>>> weectl database reconfigure --config=/etc/weewx/weewx8.conf --dry-run -y
>>> 
>>> weectl database reconfigure --config=/etc/weewx/weewx8.conf --dry-run -y
>>> Using configuration file /etc/weewx/weewx8.conf
>>> This is a dry run. Nothing will actually be done.
>>> Copying database 'weewx_ecowitt_http_ws6210.sdb' to 
>>> 'weewx_ecowitt_http_ws6210.sdb_new'
>>> Units will be converted from the 'US' system to the 'METRICWX' system.
>>> 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 715, in reconfig
>>>     record_generator = 
>>> weewx.units.GenWithConvert(old_archive.genBatchRecords(),
>>>                        ^^^^^
>>> UnboundLocalError: cannot access local variable 'weewx' where it is not 
>>> associated with a value
>>> 
>>> How can I fix this error?
>>> 
>> 
>>> -- 
>>> 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/871567a8-e4c3-450a-b398-626657751352n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/weewx-user/871567a8-e4c3-450a-b398-626657751352n%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion visit 
> https://groups.google.com/d/msgid/weewx-user/1ee24c8f-0bfe-44e8-a30a-c7cb87495037n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/weewx-user/1ee24c8f-0bfe-44e8-a30a-c7cb87495037n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/CA413DB6-86CD-4D28-8A53-62AF35189B70%40geddy.au.

Reply via email to