TypeError: '<=' not supported between instances of 'int' and 'NoneType'

192 views
Skip to first unread message

Dan'l B

unread,
Jan 18, 2026, 1:47:02 PMJan 18
to weewx-user
Running 5.2 in a venn on Ubuntu VM in Parallels, with Forecast extension 4 installed and it throws me the following error. I can go look at line 143 but am not sure how to cure the error.

2026-01-18T13:25:31.607940-05:00 ubuntu-gnu-linux-24-04-3 weewxd[14663]: ERROR weewx.cheetahgenerator: ****    File "_home_house_weewx_data_skins_forecast_multiple_tables_html_tmpl.py", line 143, in respond
2026-01-18T13:25:31.607998-05:00 ubuntu-gnu-linux-24-04-3 weewxd[14663]: ERROR weewx.cheetahgenerator: ****    File "/home/house/weewx-venv/lib/python3.12/site-packages/Cheetah/Template.py", line 1712, in _handleCheetahInclude
2026-01-18T13:25:31.608034-05:00 ubuntu-gnu-linux-24-04-3 weewxd[14663]: ERROR weewx.cheetahgenerator: ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
2026-01-18T13:25:31.608073-05:00 ubuntu-gnu-linux-24-04-3 weewxd[14663]: ERROR weewx.cheetahgenerator: ****    File "_home_house_weewx_data_skins_forecast_forecast_table_inc.py", line 1178, in respond
2026-01-18T13:25:31.608130-05:00 ubuntu-gnu-linux-24-04-3 weewxd[14663]: ERROR weewx.cheetahgenerator: ****  TypeError: '<=' not supported between instances of 'int' and 'NoneType'

John Kline

unread,
Jan 18, 2026, 2:33:14 PMJan 18
to weewx...@googlegroups.com, weewx-user
Please skins/forecast/forecast_table.inc with the file attached and let me know how that works out.

forecast_table.inc

Dan Hinckley

unread,
Jan 18, 2026, 3:15:54 PMJan 18
to weewx...@googlegroups.com
John,

Swapped that in, and we still seem to have the error. Do you need more info from me?

2026-01-18T15:06:01.851681-05:00 ubuntu-gnu-linux-24-04-3 weewxd[24104]: ERROR weewx.cheetahgenerator: ****    File "/home/house/weewx-venv/lib/python3.12/site-packages/weewx/cheetahgenerator.py", line 334, in generate
2026-01-18T15:06:01.851751-05:00 ubuntu-gnu-linux-24-04-3 weewxd[24104]: ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
2026-01-18T15:06:01.851787-05:00 ubuntu-gnu-linux-24-04-3 weewxd[24104]: ERROR weewx.cheetahgenerator: ****                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-01-18T15:06:01.851843-05:00 ubuntu-gnu-linux-24-04-3 weewxd[24104]: ERROR weewx.cheetahgenerator: ****    File "_home_house_weewx_data_skins_forecast_single_strip_html_tmpl.py", line 110, in respond
2026-01-18T15:06:01.851882-05:00 ubuntu-gnu-linux-24-04-3 weewxd[24104]: ERROR weewx.cheetahgenerator: ****    File "/home/house/weewx-venv/lib/python3.12/site-packages/Cheetah/Template.py", line 1712, in _handleCheetahInclude
2026-01-18T15:06:01.851901-05:00 ubuntu-gnu-linux-24-04-3 weewxd[24104]: ERROR weewx.cheetahgenerator: ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
2026-01-18T15:06:01.851931-05:00 ubuntu-gnu-linux-24-04-3 weewxd[24104]: ERROR weewx.cheetahgenerator: ****    File "_home_house_weewx_data_skins_forecast_forecast_strip_inc.py", line 978, in respond
2026-01-18T15:06:01.851962-05:00 ubuntu-gnu-linux-24-04-3 weewxd[24104]: ERROR weewx.cheetahgenerator: ****  TypeError: '<' not supported between instances of 'int' and 'NoneType'
2026-01-18T15:06:02.021614-05:00 ubuntu-gnu-linux-24-04-3 weewxd[24104]: DEBUG user.purple: new_loop_packet(Event type: <class 'weewx.NEW_LOOP_PACKET'> | packet: {'dateTime': 1768766761, 'usUnits': 17, 'windSpeed': 0.73, 'windDir': 251})


On Jan 18, 2026, at 14:32, 'John Kline' via weewx-user <weewx...@googlegroups.com> wrote:

Please skins/forecast/forecast_table.inc with the file attached and let me know how that works out.


--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/-67wc9q71UU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/3D7AB7A4-D654-4B30-84D1-103DDF004D2F%40johnkline.com.
<forecast_table.inc>


On Jan 18, 2026, at 10:47 AM, Dan'l B <dan.hi...@gmail.com> wrote:


--
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 weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/b96ba5a3-8541-488e-9f9f-0d190618ce1fn%40googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/-67wc9q71UU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/3D7AB7A4-D654-4B30-84D1-103DDF004D2F%40johnkline.com.

p q

unread,
Jan 18, 2026, 3:26:38 PMJan 18
to weewx...@googlegroups.com
The error is happening because the program is trying compare an empty value with an integer. This was ok in very old python but not in Python 3.x. What you need to do is change the comparison to first check if the variable is none before doing the comparison. If the variable is X, it's something like
if X is not None or X >= 1234:

You can ask Claude or ChatGPT or some other LLM to help with the syntax if you get stuck.




--
Peter Quinn
(415)794-2264

John Kline

unread,
Jan 18, 2026, 3:57:19 PMJan 18
to weewx...@googlegroups.com, weewx...@googlegroups.com
I sent him a file that checks for on every comparison.


On Jan 18, 2026, at 12:26 PM, p q <peterq...@gmail.com> wrote:



John Kline

unread,
Jan 18, 2026, 3:59:57 PMJan 18
to weewx...@googlegroups.com, weewx...@googlegroups.com
Actually, you no longer have that error.  This one is in forecast_strip.inc

These values should probably not be None, but the code shouldn’t error on this.  I’ll send you a forecast_strip.inc shortly.

On Jan 18, 2026, at 12:15 PM, Dan Hinckley <d...@suiattle.org> wrote:



John Kline

unread,
Jan 18, 2026, 4:11:08 PMJan 18
to weewx...@googlegroups.com, weewx...@googlegroups.com
By the way, this isn’t my code, but I seem to be the maintainer of it now.

Dan’l, it would help to know if you have nulls for sun/moon rise/set, or nulls in the tides.  Do you have xtide installed?  Are you trying the new alamanac?

My guess is that $alm.sunrise.raw and friends are None.

If you are using the new almanac, try removing it and see if you still get errors.  Either way, get back to me.

As for xtide, if you are using it, tell me how you installed it.

On Jan 18, 2026, at 12:59 PM, John Kline <jo...@johnkline.com> wrote:



Karen K

unread,
Jan 18, 2026, 4:26:48 PMJan 18
to weewx-user
John Kline schrieb am Sonntag, 18. Januar 2026 um 22:11:08 UTC+1:
If you are using the new almanac, try removing it and see if you still get errors.  

You can simply set enable=false for it to switch it off and use the original one instead.
 

weather list

unread,
Jan 19, 2026, 1:10:17 PMJan 19
to weewx...@googlegroups.com
John,

First shot: disabled Skyfield and Skymap, restarted weewx and watched:

sudo tail -f /var/log/syslog | grep TypeError

And had no results.

Karen K

unread,
Jan 19, 2026, 3:55:54 PMJan 19
to weewx-user
weather list schrieb am Montag, 19. Januar 2026 um 19:10:17 UTC+1:
First shot: disabled Skyfield and Skymap, restarted weewx and watched:

Skyfield (or more precisely the Skyfield based almanac extension) can return None for events like rising and setting if they do not take place on that day. The PyEphem based almanac returns the event of the next or previous day in that situation. This is a difference between them.

I will look into forecast_table.inc if I see more.
 

John Kline

unread,
Jan 19, 2026, 8:48:24 PMJan 19
to weewx...@googlegroups.com, weewx-user
I will put out a forecast that guards against None for sun/moon rise/set.

Having said that, do we want None to be returned if the moonset is after midnight?

On Jan 19, 2026, at 12:56 PM, Karen K <kk44...@gmail.com> wrote:


--
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 weewx-user+...@googlegroups.com.

Tom Keffer

unread,
Jan 19, 2026, 8:59:34 PMJan 19
to weewx...@googlegroups.com
There was an issue discussion about this: https://github.com/weewx/weewx/issues/995

The issue was eventually declared stale.

Karen K

unread,
Jan 20, 2026, 12:54:51 AMJan 20
to weewx-user
John Kline schrieb am Dienstag, 20. Januar 2026 um 02:48:24 UTC+1:
I will put out a forecast that guards against None for sun/moon rise/set.

I guess moonrise and moonset will be enough, as the Sun rises and sets every day (except polar regions) but the Moon does not. 

Having said that, do we want None to be returned if the moonset is after midnight?

As an alternative you could take the timestamp of moonrise and calculate the next setting then like $almanac(almanac_time=$almanac.moon.rise).moon.next_setting. Then you catch moonset after midnight. But what I got from a short glimpse into the code of forecast_table.inc the events are filtered there if they are within the respective forecast period. A moonset after midnight would be filtered there anyway, if I got that right.

John Kline

unread,
Jan 20, 2026, 1:01:04 AMJan 20
to weewx...@googlegroups.com, weewx...@googlegroups.com
Tom, that was a reasonable discussion.  I didn’t notice anything that suggests returning None if the rise/set doesn’t happen today.

It seems like we got to this point because the seasons skin only displays the time of the rise/set.  That’s kind of a crazy reason, but I’ll drop it now.

On Jan 19, 2026, at 5:59 PM, Tom Keffer <tke...@gmail.com> wrote:



John Kline

unread,
Jan 20, 2026, 1:06:06 AMJan 20
to weewx...@googlegroups.com, weewx-user
I’d prefer not to spend a lot of time on the forecast module.  I got stuck with it because I ported it to WeeWX 4 and others asked me to share.  I don’t actually use the forecast module myself.  I haven’t complained before about keeping forecast running, but having to deal with users installing an extension, being pushed on this list, that returns None for the next rise/set certainly has me annoyed.

On Jan 19, 2026, at 9:54 PM, Karen K <kk44...@gmail.com> wrote:

--
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 weewx-user+...@googlegroups.com.

Vince Skahan

unread,
Jan 20, 2026, 1:51:30 AMJan 20
to weewx-user
Perhaps obvious from the cheap seats but you could hypothetically mark your repo with a banner saying it’s being made available only as a courtesy and should be considered unmaintained at this point. 

matthew wall

unread,
Jan 20, 2026, 6:32:36 AMJan 20
to weewx...@googlegroups.com
john,

thank you for handling forecast issue. i created that monster, and there are many things i would like to do to extend and modularize it. unfortunately my work is demanding far too much of my time right now.

conceptually a None makes sense - when there is no next rise/set the value is None. but having None as a possible value means that any code that renders or compares or whatever has to deal with None. in the cheetahgenerator we made simple wrappers to_int, to_bool, etc.

m
> To view this discussion visit https://groups.google.com/d/msgid/weewx-user/F4463BB2-0036-453C-BBAF-7BFF7F3BC9DB%40johnkline.com.

John Kline

unread,
Jan 20, 2026, 10:24:12 AMJan 20
to weewx...@googlegroups.com, weewx...@googlegroups.com
>> conceptually a None makes sense - when there is no next rise/set the value is None
That is not the case here. There is a next rise/set.

> On Jan 20, 2026, at 3:32 AM, matthew wall <mwall...@gmail.com> wrote:
>
> john,
> To view this discussion visit https://groups.google.com/d/msgid/weewx-user/66BF664C-BF97-4EE8-8A12-9CE2F07223D1%40gmail.com.

Karen K

unread,
Jan 20, 2026, 1:24:58 PMJan 20
to weewx-user
John Kline schrieb am Dienstag, 20. Januar 2026 um 16:24:12 UTC+1:
>> conceptually a None makes sense - when there is no next rise/set the value is None
That is not the case here. There is a next rise/set. 

In general there is always a next rise/set. But it is not necessary within the timespan you are interested in.

John Kline

unread,
Jan 20, 2026, 5:07:34 PMJan 20
to weewx...@googlegroups.com, weewx-user
Let’s be real.  You have redefined $almanac.moon.rise (and the rest) to return None if you get an answer back that is after today.  It was not that way before.  The almanac was supposed to be a drop in replacement.  The correct thing to do would have been to fix the Seasons skin (and others by their authors) if they are displaying only the time.  Personally, I like Tom’s idea of displaying +1 (for plus one day, or +n in general).   Regardless, you’ve the behavior of the almanac.  Your suggestion that, if the moonrise is after midnight, its not within the timespan I am interested in is bizarre; especially since I have not specified a timespan with $almanac.moon.rise.

On Jan 20, 2026, at 10:25 AM, Karen K <kk44...@gmail.com> wrote:

--
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 weewx-user+...@googlegroups.com.

Karen K

unread,
Jan 21, 2026, 11:19:28 AMJan 21
to weewx-user
John Kline schrieb am Dienstag, 20. Januar 2026 um 23:07:34 UTC+1:
Your suggestion that, if the moonrise is after midnight, its not within the timespan I am interested in is bizarre; especially since I have not specified a timespan with $almanac.moon.rise.

What, do you think, is the difference between $almanac.moon.rise und $almanac.moon.next_rising? It would make no sense, if they returned the same. 
 

John Kline

unread,
Jan 21, 2026, 4:17:58 PMJan 21
to weewx...@googlegroups.com, weewx-user
> What, do you think, is the difference between $almanac.moon.rise und $almanac.moon.next_rising? It would make no sense, if they returned the same. 

They are the same.  See almanac.py in the weewx source code:

fn_map = {'rise': 'next_rising',
          'set': 'next_setting',
          'transit': 'next_transit'}

On Jan 21, 2026, at 8:19 AM, Karen K <kk44...@gmail.com> wrote:

John Kline schrieb am Dienstag, 20. Januar 2026 um 23:07:34 UTC+1:
Your suggestion that, if the moonrise is after midnight, its not within the timespan I am interested in is bizarre; especially since I have not specified a timespan with $almanac.moon.rise.

What, do you think, is the difference between $almanac.moon.rise und $almanac.moon.next_rising? It would make no sense, if they returned the same. 
 

--
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 weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages