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

ERROR weewx.cheetahgenerator: **** Reason: '>=' not supported between instances of 'NoneType' and 'float' #9

Closed
Daveiano opened this issue May 28, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@Daveiano
Copy link
Owner

Daveiano commented May 28, 2022

May 28 12:35:16 raspberrypi weewx[8931] INFO weewx.manager: Added record 2022-05-28 12:35:00 EDT (1653755700) to database 'weewx.sdb'
May 28 12:35:16 raspberrypi weewx[8931] INFO weewx.manager: Added record 2022-05-28 12:35:00 EDT (1653755700) to daily summary in 'weewx.sdb'
May 28 12:35:20 raspberrypi weewx[8931] INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 1.54 seconds
May 28 12:35:21 raspberrypi weewx[8931] INFO weewx.imagegenerator: Generated 15 images for report SeasonsReport in 0.95 seconds
May 28 12:35:21 raspberrypi weewx[8931] INFO weewx.reportengine: Copied 0 files to /var/www/html/weewx
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: Evaluation of template /etc/weewx/skins/weewx-wdc/year-%Y.html.tmpl failed with exception '<class 'TypeError'>'
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/weewx-wdc/year-%Y.html.tmpl
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: **** Reason: '>=' not supported between instances of 'NoneType' and 'float'
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 348, in generate
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_weewx_wdc_year__Y_html_tmpl.py", line 183, in respond
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1707, in _handleCheetahInclude
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_weewx_wdc_includes_climatological_days_inc.py", line 277, in respond
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_weewx_wdc_includes_climatological_days_inc.py", line 106, in __errorCatcher6
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "<string>", line 1, in <module>
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/user/stats_util.py", line 175, in get_climatological_day
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****      return len(list(days))
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/user/stats_util.py", line 173, in <lambda>
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****      days = filter(lambda x: x.raw >= value, list(day_series.data))
May 28 12:35:23 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****  TypeError: '>=' not supported between instances of 'NoneType' and 'float'
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: Evaluation of template /etc/weewx/skins/weewx-wdc/statistics.html.tmpl failed with exception '<class 'TypeError'>'
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/weewx-wdc/statistics.html.tmpl
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: **** Reason: '>=' not supported between instances of 'NoneType' and 'float'
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 348, in generate
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_weewx_wdc_statistics_html_tmpl.py", line 191, in respond
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1707, in _handleCheetahInclude
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_weewx_wdc_includes_climatological_days_inc.py", line 277, in respond
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_weewx_wdc_includes_climatological_days_inc.py", line 106, in __errorCatcher6
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "<string>", line 1, in <module>
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/user/stats_util.py", line 175, in get_climatological_day
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****      return len(list(days))
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/user/stats_util.py", line 173, in <lambda>
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****      days = filter(lambda x: x.raw >= value, list(day_series.data))
May 28 12:35:35 raspberrypi weewx[8931] ERROR weewx.cheetahgenerator: ****  TypeError: '>=' not supported between instances of 'NoneType' and 'float'
May 28 12:35:35 raspberrypi weewx[8931] INFO weewx.cheetahgenerator: Generated 9 files for report WdcReport in 14.05 seconds
May 28 12:35:35 raspberrypi weewx[8931] INFO weewx.reportengine: Copied 0 files to /var/www/html/weewx/wdc

Original issue posted on https://groups.google.com/g/weewx-user/c/sDK4kzO4vBw/m/6IyK1zXTAgAJ

@Daveiano Daveiano added the bug Something isn't working label May 28, 2022
@Daveiano Daveiano self-assigned this May 28, 2022
@rromanchuk
Copy link
Contributor

hey @Daveiano I'm now getting this after enabling NWS forecasts, do you have any tricks to get the line num around where the fatal was thrown in the actual template? Or maybe a verbosity settings that I can pass to wee_report or something?

The only suspicious looking place I found just poking around

#set $forecat_table_active = True if $varExists('forecast') and len($forecast.weather_periods($forecast_source)) > 0 else False

but it's getting coerced to int, so can't be the NoneType. Is there any easy way to like try/catch the forecast template inclusion so I can at least allow index.html to generate?

Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: Evaluation of template /etc/weewx/skins/weewx-wdc/index.html.tmpl failed with exception '<class 'TypeError'>'
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/weewx-wdc/index.html.tmpl
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: **** Reason: '>' not supported between instances of 'NoneType' and 'int'
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 348, in generate
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_weewx_wdc_index_html_tmpl.py", line 171, in respond
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1708, in _handleCheetahInclude
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_weewx_wdc_includes_body_alternative_inc.py", line 206, in respond
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1708, in _handleCheetahInclude
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_weewx_wdc_includes_forecast_inc.py", line 222, in respond
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1708, in _handleCheetahInclude
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_weewx_wdc_includes_forecast_table_inc.py", line 1129, in respond
Feb 16 09:50:35 wx weewx[1586810] ERROR weewx.cheetahgenerator: ****  TypeError: '>' not supported between instances of 'NoneType' and 'int'

@Daveiano
Copy link
Owner Author

@rromanchuk I am pretty sure there is a problem in includes/forecast-table.inc

One bug already solved on the 3.x branch (not published to a release yet) was the rain/snow handling in the forecast. Could you please try to disable precip in the forecast or is it already disabled (in skin.conf:)?

[[forecast_table_settings]]
        source = NWS
        num_periods = 72
        num_days = 5
        show_hourly = 1
        show_day = 1
        show_date = 1
        show_outlook = 1
        show_temp = 1
        show_dewpoint = 0
        show_humidity = 0
        show_wind = 1
        show_tides = 0
        show_sun = 1
        show_moon = 1
        show_pop = 1
        show_precip = 0

Otherwise, you could try to disable one property of the forecast_table after another to find the buggy one. I will be able to test this with NWS data after the weekend.

@rromanchuk
Copy link
Contributor

I'm going to jump on your 3.x branch. I hot fixed it on the pi with a null check. When you develop locally is it essentially yarn build and use the weewx simulator driver?

@Daveiano
Copy link
Owner Author

Can you tell me what file and line you edited? I am also happy to accept any PR's.

Yes yarn install and yarn run build are needed to generate the Javascript and CSS files.

@rromanchuk
Copy link
Contributor

@Daveiano yeah, just wanted to actually test before PR.

It was a single line, all the rest were protected, this must have just slipped through. Didn't look into the why or how yet, but this was the issue. Working perfectly on 2.x and 3.x

rromanchuk@7691600#diff-1ccb9eb11789f9202782aea6c9471642b66c5691b05ff08bf019dd8839962a30R716

@Daveiano
Copy link
Owner Author

Daveiano commented Feb 25, 2023

@rromanchuk I created PR #118 from your patch-1 branch. It seems the necessary change is in this branch?

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