If you added the additional fields in extensions.py you should be OK. That
file is imported before starting processing.

On Tue, Nov 4, 2025 at 9:16 AM 'Werner Krenn' via weewx-user <
[email protected]> wrote:

> Tom
>  thanks, it worked.
>
> *I have another question:*
>
> I'm using additional fields, e.g., "co2_Temp" with the group
> "group_temperature". To ensure this field is also converted, I'm adding
> these fields and their group assignments to "units.py".
>
> Could this assignment also be entered into "extensions.py" so that the
> conversion is performed?
>
> Werner
>
> Tom Keffer schrieb am Montag, 3. November 2025 um 22:18:18 UTC+1:
>
>> 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].
> To view this discussion visit
> https://groups.google.com/d/msgid/weewx-user/a81e75d7-61ea-4e6d-888c-81ad4f21d73fn%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/a81e75d7-61ea-4e6d-888c-81ad4f21d73fn%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/CAPq0zECMRuNFJZkR2pmaBuky4CcONrm0%3Dq19hzgnM9fNVLXuvg%40mail.gmail.com.

Reply via email to