weewx-wd (tags.py) fails after upgrade to 4.6

201 views
Skip to first unread message

bob_linux_user

unread,
Feb 9, 2022, 12:39:19 PM2/9/22
to weewx-user
I have been attempting to find the API calls to fix 4.6. It fails in tags.py with the the group_deltatime issue. I have not been able to determine where to change the code to add the line 
context='short_delta'. I am not a python programmer. Any help would be appreciated.

vince

unread,
Feb 9, 2022, 2:15:51 PM2/9/22
to weewx-user
Some log snippets or pointer to the tags.py file you are using would be helpful....

bob_linux_user

unread,
Feb 9, 2022, 3:00:20 PM2/9/22
to weewx-user
Thanks for your reply, below is the error and I have attached "tags.py"

Feb  9 07:01:42 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: Evaluation of template /etc/weewx/skins/Testtags/testtags.php.tmpl failed with exception '<type 'exceptions.KeyError'>'
Feb  9 07:01:42 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/Testtags/testtags.php.tmpl
Feb  9 07:01:42 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: **** Reason: 'trend'
Feb  9 07:01:42 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Feb  9 07:01:42 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 344, in generate
Feb  9 07:01:42 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Feb  9 07:01:42 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_Testtags_testtags_php_tmpl.py", line 1061, in respond
Feb  9 07:01:42 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/tags.py", line 65, in trend
Feb  9 07:01:42 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****      time_grace = to_int(self.option_dict['trend'].get('time_grace', 300))
Feb  9 07:01:42 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****  KeyError: 'trend'
Feb  9 07:01:42 W4LCS-Server weewx[10341] INFO weewx.cheetahgenerator: Generated 0 files for report wdTesttags in 6.52 seconds
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: Evaluation of template /etc/weewx/skins/Clientraw/clientraw.txt.tmpl failed with exception '<type 'exceptions.KeyError'>'
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/Clientraw/clientraw.txt.tmpl
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: **** Reason: 'trend'
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 344, in generate
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_Clientraw_clientraw_txt_tmpl.py", line 329, in respond
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****    File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1377, in varExists
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****      valueFromSearchList(self.searchList(), varName.replace('$', ''), autoCall)
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/tags.py", line 63, in trend
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****      time_delta = to_int(self.option_dict['trend'].get('time_delta', 10800))
Feb  9 07:01:47 W4LCS-Server weewx[10341] ERROR weewx.cheetahgenerator: ****  KeyError: 'trend'
tags.py

gjr80

unread,
Feb 9, 2022, 3:45:33 PM2/9/22
to weewx-user
The error you are encountering is due to some changes in WeeWX 4.6.0 that highlight some sloppy programming on my behalf in WeeWX-WD. I do not actively maintain WeeWX-WD any more (refer below) but if you are interested in fixing the issue yourself you will find the fixes I applied to WeeWX-Saratoga to fix the same issue may help (there are other approaches that can be used) but they certainly highlight the errant code.

Depending on your requirements you might want to look at replacing WeeWX-WD with WeeWX-Saratoga. WeeWX-WD was written many years ago (primarily) in order to provide WeeWX support to the Saratoga weather web site templates. This was done by having WeeWX mimic the WeatherDisplay output (testtags.php, the clientraw files, a wind rose graphic and a few others) used to drive the Saratoga templates. This approach suffered from a number of issues. Last year I collaborated with the author of the Saratoga templates and direct support for WeeWX was included in the Saratoga templates. The WeeWX-Saratoga extension was developed to allow WeeWX to produce the necessary data files for use with the Saratoga templates, testtags.php was replaced with WEEWXtags.php, the clientraws are still produced (clientraw.txt is now based on loop packet data so the Saratoga templates dashboard is provided with near real time updates) as is the wind rose graphic. Generation of the weewx_pws.xml file was dropped, though this is unlikely to be an issue as this file was used to support a now defunct mobile device app. If you are running a recent WeeWX-WD version migrating from WeeWX-WD to WeeWX-Saratoga is a straightforward process that is covered in the WeeWX-Saratoga wiki.

Gary

bob_linux_user

unread,
Feb 9, 2022, 3:53:23 PM2/9/22
to weewx-user
Thank you Gary. I was using WeeWX-WD to get data for my Carter Lake/Saratoga templates. I migrated to weewx from wview  a few years ago and at the time the WD extension was the only option. I will look at the wiki to determine if I can change to the Saratoga extension.

Bob

gjr80

unread,
Feb 9, 2022, 4:37:57 PM2/9/22
to weewx-user
Bob, in that case WeeWX-Saratoga should meet your needs - no longer will the Saratoga templates have a split WeeWX/WeatherDisplay personality. The migration process is very straightforward if you are running WeeWX-WD 2.x; it is largely just uninstall WeeWX-WD and install WeeWX-Saratoga and then set your units in weewx.conf along with one or two other things depending on your setup.

Gary

bob_linux_user

unread,
Feb 9, 2022, 7:17:26 PM2/9/22
to weewx-user
Gary,

I followed the wiki and removed the WD extension and installed the Saratoga extension. The system runs but will not generate the WEEWXtags to update the Saratoga templates. I rechecked my process and do not think I missed anything. Suggestions?

Feb  9 18:10:30 W4LCS-Server weewx[17389] ERROR weewx.cheetahgenerator: Generate failed with exception '<class 'NameMapper.NotFound'>'
Feb  9 18:10:30 W4LCS-Server weewx[17389] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/WEEWXtags/WEEWXtags.php.tmpl
Feb  9 18:10:30 W4LCS-Server weewx[17389] ERROR weewx.cheetahgenerator: **** Reason: cannot find 'replace' while searching for 'replace'
Feb  9 18:10:30 W4LCS-Server weewx[17389] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Feb  9 18:10:30 W4LCS-Server weewx[17389] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 326, in generate
Feb  9 18:10:30 W4LCS-Server weewx[17389] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Feb  9 18:10:30 W4LCS-Server weewx[17389] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_WEEWXtags_WEEWXtags_php_tmpl.py", line 127, in respond
Feb  9 18:10:30 W4LCS-Server weewx[17389] ERROR weewx.cheetahgenerator: ****  NotFound: cannot find 'replace' while searching for 'replace'

Bob

gjr80

unread,
Feb 9, 2022, 7:49:10 PM2/9/22
to weewx-user
Bob,

I haven't seen that one before, am taking a quick guess but could you post a copy of skin.conf from the WEEWXtags skin along with the [StdReport] [[WEEWXtagsReport]] stanza of weewx.conf. If you limit yourself to just the [StdReport] [[WEEWXtagsReport]] stanza of weewx.conf it should contain no sensitive info, likewise skin.conf. But of course double check before posting for user names, passwords, API keys etc.

I will be out for a few hours so will not look at this again until later today.

Gary

bob_linux_user

unread,
Feb 9, 2022, 8:15:38 PM2/9/22
to weewx-user
Gary,

Below is the weewx conf and attached is the skin for WEEWXtags.

Bob
weewx.conf:

[[StandardReport]]
        # See the customizing guide to change the units, plot types and line
        # colors, modify the fonts, display additional sensor data, and other
        # customizations. Many of those changes can be made here by overriding
        # parameters, or by modifying templates within the skin itself.
       
        # The StandardReport uses the 'Standard' skin, which contains the
        # images, templates and plots for the report.
        skin = Standard
        [[[Units]]]
            [[[[Groups]]]]
                group_altitude = foot
                group_speed2 = mile_per_hour2
                group_pressure = inHg
                group_rain = inch
                group_rainrate = inch_per_hour
                group_temperature = degree_F
                group_degree_day = degree_F_day
                group_speed = mile_per_hour
    [[WEEWXtagsReport]]
        skin = WEEWXtags
        enable = True
    [[[Units]]]
        [[[[TimeFormats]]]]
            date_f = %d/%m/%Y,
            date_time_f = %d/%m/%Y %H:%M
    [[ClientrawReport]]
        skin = Clientraw
        enable = True
    [[[Units]]]
        [[[[StringFormats]]]]
            degree_C = %.1f
            degree_compass = %.0f
            foot = %.0f
            hPa = %.1f
            km = %.1f
            knot = %.1f
            mm = %.1f
            percent = %.0f
            uv_index = %.1f
            watt_per_meter_squared = %.0f
            NONE = --          

skin.conf

gjr80

unread,
Feb 10, 2022, 6:51:56 PM2/10/22
to weewx-user
Bob,

Here is the problem:

    [[WEEWXtagsReport]]
        skin = WEEWXtags
        enable = True
        [[[Units]]]
            [[[[TimeFormats]]]]
                date_f = %d/%m/%Y,
                date_time_f = %d/%m/%Y %H:%M

The comma at the end of the date_f option line is forcing that option to be treated as a python list rather than a string. Consequently the string replace operation in the template fails. You have two options; either remove the comma or if the comma is required as a literal character (not sure why as the Saratoga templates do not require it) then enclose the entire setting in single or double quotes.

Either way you will need to restart WeeWX for the change to take effect.

Gary

bob_linux_user

unread,
Feb 10, 2022, 8:32:38 PM2/10/22
to weewx-user
That did stop the Cheetah crash. The log is now clean. My wxindex.php and ajax no longer work but Steel Series gauges and the weewx pages are fine. I will have to troubleshoot my php files to see where they are looking for updates (Testtags or WEEWXtags). Thanks for your help;

Bob 

gjr80

unread,
Feb 10, 2022, 8:52:28 PM2/10/22
to weewx-user
That's good. Possibly some WeeWX-Saratoga data files are now going to a different place or otherwise not where the templates expect. Sing out if you need any help getting the extension to do what it should.

Gary
Reply all
Reply to author
Forward
0 new messages