HI Graham,
I’m running 5.2 and I took the line
         schema = weewx.schemas.wview_extended.schema
straight out of the weewx.conf distributed with weewx5.2.  So I think that the 
I was pointing to the correct schema/location, but there is a bug in manager.py 
that Tom has fixed with the version he posted in this thread.  Hopefully it 
will go into 5.2.1 (or whatever).  

Bob
> On Nov 27, 2025, at 15:35, Graham Eddy <[email protected]> wrote:
> 
> 
> 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
>>> 
>>>> 

-- 
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/2BB8A5D6-DB12-453A-8318-FD7DB7947163%40gmail.com.

Reply via email to