Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] year-%Y.html.tmpl fails when changing group_speed to knots in weewx.conf #239

Closed
nicholaswaton opened this issue Jan 9, 2024 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@nicholaswaton
Copy link

Describe the bug
I am on version 3.4. I've been trying to change the wind unit to knots.

To Reproduce
When I modify the weewx.conf file to show knots instead of mph by adding this

[[[Units]]]
[[[[Groups]]]]
group_speed = knot
group_speed2 = knot

I added the same to skin.conf

I restart the server and republish the reports. All reports work fine and show knots except the yearly reports for specific years as seen below. I can't figure what I am doing wrong and the error seems so unrelated to Units.

Additional context
Evaluation of template /etc/weewx/skins/weewx-wdc/year-%Y.html.tmpl failed with exception '<class 'NameError'>'
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/weewx-wdc/year-%Y.html.tmpl
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** Reason: free variable 'value' referenced before assignment in enclosing scope
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** Traceback (most recent call last):
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 348, in generate
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** unicode_string = compiled_template.respond()
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** File "_etc_weewx_skins_weewx_wdc_year__Y_html_tmpl.py", line 203, in respond
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1708, in _handleCheetahInclude
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** File "_etc_weewx_skins_weewx_wdc_includes_climatological_days_inc.py", line 503, in respond
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** File "_etc_weewx_skins_weewx_wdc_includes_climatological_days_inc.py", line 142, in __errorCatcher11
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** File "", line 1, in
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** File "/usr/share/weewx/user/weewx_wdc.py", line 2247, in get_climatological_day
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** return len(list(days))
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** File "/usr/share/weewx/user/weewx_wdc.py", line 2244, in
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** (windGust, windGust_max_vt[1], windGust_max_vt[2]))[0] >= value, windGust_max_vt[0]
Jan 9 19:53:17 bigfastlittledisk weewx[170113] ERROR weewx.cheetahgenerator: **** NameError: free variable 'value' referenced before assignment in enclosing scope

@nicholaswaton nicholaswaton added the bug Something isn't working label Jan 9, 2024
@nicholaswaton nicholaswaton changed the title [BUG] when changing group_speed to knots in weewx.conf, and restarting weewx, breaks [BUG] year-%Y.html.tmpl fails when changing group_speed to knots in weewx.conf Jan 9, 2024
@Daveiano Daveiano added this to the 3.5.0 milestone Jan 9, 2024
@Daveiano
Copy link
Owner

Hello there!

Yes, I can reproduce the bug. I did not take into account that somebody could use knots as the unit for wind/gust speed, etc. This breaks the calculation of storm days.

I added a fix for that in a193aa5. Could you please test this change out? You would need to make the changes in weewx_wdc.py. The file is located in the "Executables" directory, see https://weewx.com/docs/4.10/usersguide.htm#Where_to_find_things

@nicholaswaton
Copy link
Author

yes, it fixed the bug, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants