Is there no log message above the error you sent?  Did you restart weewx?  In what directory did you change rtgd.py?

On Nov 19, 2025, at 2:02 PM, 'Ron Walker' via weewx-user <[email protected]> wrote:

John,

Let me clarify.  I did exactly what Glen said and replaced the double quotes in the line.  I then restarted weewx and got a similar error message.  It looked to me as though it was pointing to the single quotes, which I replaced.  I then restarted weewx and got the error in the previous message.

Next, I tried just retyping the line entirely and get the following error along with the output from the log.info. It seems to point to the line following the log.info line,which I did not touch!

INFO user.rtgd: ts: 1763588923 (1763588923), self.cache[obs]['ts']: 1763588923 (1763588923), max_age: 600 (600)
CRITICAL user.rtgd: Unexpected exception of type <class 'TypeError'>
DEBUG user.rtgd: rtgdthread: **** Traceback (most recent call last):
DEBUG user.rtgd: rtgdthread: ****   File "/etc/weewx/bin/user/rtgd.py", line 1825, in run
DEBUG user.rtgd: rtgdthread: ****     self.process_packet(_package['payload'])
DEBUG user.rtgd: rtgdthread: ****     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
DEBUG user.rtgd: rtgdthread: ****   File "/etc/weewx/bin/user/rtgd.py", line 1880, in process_packet
DEBUG user.rtgd: rtgdthread: ****     cached_packet = self.packet_cache.get_packet(_conv_packet['dateTime'],
DEBUG user.rtgd: rtgdthread: ****                                                  self.max_cache_age)
DEBUG user.rtgd: rtgdthread: ****   File "/etc/weewx/bin/user/rtgd.py", line 2908, in get_packet
DEBUG user.rtgd: rtgdthread: ****     packet[obs] = self.get_value(obs, ts, max_age)
DEBUG user.rtgd: rtgdthread: ****                   ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
DEBUG user.rtgd: rtgdthread: ****   File "/etc/weewx/bin/user/rtgd.py", line 2894, in get_value
DEBUG user.rtgd: rtgdthread: ****     if obs in self.cache and ts - self.cache[obs]['ts'] <= max_age:
DEBUG user.rtgd: rtgdthread: ****                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
DEBUG user.rtgd: rtgdthread: **** TypeError: '<=' not supported between instances of 'int' and 'str'
CRITICAL user.rtgd: Thread exiting. Reason: '<=' not supported between instances of 'int' and 'str'

 
The line referenced in the error:
if obs in self.cache and ts - self.cache[obs]['ts'] <= max_age:

On Wednesday, November 19, 2025 at 4:20:43 PM UTC-5 John Kline wrote:
Hey can’t be single quotes because there are single quotes inside the string.  Replace the things that look like double quotes with actual double quotes.

On Nov 19, 2025, at 1:18 PM, 'Ron Walker' via weewx-user <[email protected]> wrote:

Glen, John,

I deleted and replaced the double and single quotes in the code.  It turns out that single quotes threw the same error when I restarted weewx.  Here the log output from the restart:

DEBUG weewx.engine: Loading service user.rtgd.RealtimeGaugeData
INFO user.rtgd: version is 0.5.5
DEBUG weewx.manager: Daily summary version is 4.0
INFO user.rtgd: Unknown block specified for scroller_text
INFO user.rtgd: gauge-data.txt will not be exported.
INFO user.rtgd: '/var/www/html/weewx/steelseries/gauge-data.txt' will be generated. min_interval is 2 seconds
DEBUG weewx.engine: Finished loading service user.rtgd.RealtimeGaugeData
INFO __main__: Starting up weewx version 5.2.0
DEBUG weewx.engine: Station does not support reading the time
INFO weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb'
INFO weewx.manager: Starting backfill of daily summaries
INFO weewx.manager: Empty database
INFO weewx.engine: Starting main packet loop.
DEBUG weewx.manager: Daily summary version is 4.0
DEBUG weewx.manager: Daily summary version is 4.0
CRITICAL user.rtgd: Unexpected exception of type <class 'KeyError'>
DEBUG user.rtgd: rtgdthread: **** Traceback (most recent call last):
DEBUG user.rtgd: rtgdthread: ****   File "/etc/weewx/bin/user/rtgd.py", line 1825, in run
DEBUG user.rtgd: rtgdthread: ****     self.process_packet(_package['payload'])
DEBUG user.rtgd: rtgdthread: ****     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
DEBUG user.rtgd: rtgdthread: ****   File "/etc/weewx/bin/user/rtgd.py", line 1870, in process_packet
DEBUG user.rtgd: rtgdthread: ****     _conv_packet = weewx.units.to_std_system(packet,
DEBUG user.rtgd: rtgdthread: ****                                              self.stats_unit_system)
DEBUG user.rtgd: rtgdthread: ****   File "/usr/share/weewx/weewx/units.py", line 1613, in to_std_system
DEBUG user.rtgd: rtgdthread: ****     _datadict_target = StdUnitConverters[unit_system].convertDict(datadict)
DEBUG user.rtgd: rtgdthread: ****                        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
DEBUG user.rtgd: rtgdthread: **** KeyError: None
CRITICAL user.rtgd: Thread exiting. Reason: None


Thanks for staying with me on this!

On Wednesday, November 19, 2025 at 2:25:37 PM UTC-5 Glenn McKechnie wrote:
On Thu, 20 Nov 2025 at 05:34, 'Ron Walker' via weewx-user <[email protected]> wrote:
John,

I deleted the max_cache_age line and retyped it, in case there was any text I couldn't see.

Here is the line you requested:
File "/etc/weewx/bin/user/rtgd.py", line 2893
    log.info(\u201cts: %s (%s), self.cache[obs][\u2018ts\u2019]: %s (%s), max_age: %s (%s)\u201d % (ts, ts, self.cache[obs][\u2018ts\u2019], self.cache[obs][\u2018ts\u2019], max_age, max_age))
             ^
SyntaxError: invalid character '\u201c' (U+201C)


That syntax error is the result of non-ascii characters in your log.info string. Specifically - smart quotes. They are showing up as \u201c and \201d instead.

Where you see " or   ie :- 'double quotes' delete them and replace them with the plain " character from your keyboard. Use a plain text editor to do it and it will have no choice but to insert the correct character. Use nano, vim or whatever is your favourite editor

There is a subtle difference in their appearance and while they appear the same, they are most definitely not.


Cheers
 Glenn (VK3GLN)

Various WeeWx addons at
https://github.com/glennmckechnie 

--
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].

--
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/5fabfcb7-59e5-46ce-aed8-ff212d348b53n%40googlegroups.com.

--
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/C50AED75-9744-4916-8190-32E82E3083A5%40johnkline.com.

Reply via email to