"Formatting options with [un]expected results" -- using leafTemp1 for non-temperature measurement so trying to remove "°F"

111 views
Skip to first unread message

Messy Potamia

unread,
Apr 13, 2020, 5:33:23 PM4/13/20
to weewx-user
Trying to change the default format in reports for leafTemp1 from "degF"  to nothing, or just 2.2f, so followed the guide, http://www.weewx.com/docs/customizing.htm#formatting_options,  to current.leafTemp1.format(add_label=False)
and I'm getting all kinds of errors. Just changed to .format(), since doc says it's an option, now I "only" get these errors:
Apr 13 23:20:17 RPI3 weewx[25402]: cheetahgenerator: Generate failed with exception '<type 'exceptions.TypeError'>'
Apr 13 23:20:17 RPI3 weewx[25402]: cheetahgenerator: **** Ignoring template /home/weewx/skins/Standard/week.html.tmpl
Apr 13 23:20:17 RPI3 weewx[25402]: cheetahgenerator: **** Reason: format() takes at least 2 arguments (1 given)
Apr 13 23:20:17 RPI3 weewx[25402]: ****  Traceback (most recent call last):
Apr 13 23:20:17 RPI3 weewx[25402]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 315, in generate
Apr 13 23:20:17 RPI3 weewx[25402]: ****      print >> _file, text
Apr 13 23:20:17 RPI3 weewx[25402]: ****    File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in __str__
Apr 13 23:20:17 RPI3 weewx[25402]: ****      rc = getattr(self, mainMethName)()
Apr 13 23:20:17 RPI3 weewx[25402]: ****    File "_home_weewx_skins_Standard_week_html_tmpl.py", line 1095, in respond
Apr 13 23:20:17 RPI3 weewx[25402]: ****    File "_home_weewx_skins_Standard_week_html_tmpl.py", line 322, in __errorCatcher37
Apr 13 23:20:17 RPI3 weewx[25402]: ****    File "<string>", line 1, in <module>
Apr 13 23:20:17 RPI3 weewx[25402]: ****  TypeError: format() takes at least 2 arguments (1 given)
Apr 13 23:20:19 RPI3 weewx[25402]: cheetahgenerator: Generate failed with exception '<type 'exceptions.TypeError'>'
Apr 13 23:20:19 RPI3 weewx[25402]: cheetahgenerator: **** Ignoring template /home/weewx/skins/Standard/index.html.tmpl
Apr 13 23:20:19 RPI3 weewx[25402]: cheetahgenerator: **** Reason: format() takes at least 2 arguments (1 given)
Apr 13 23:20:19 RPI3 weewx[25402]: ****  Traceback (most recent call last):
Apr 13 23:20:19 RPI3 weewx[25402]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 315, in generate
Apr 13 23:20:19 RPI3 weewx[25402]: ****      print >> _file, text
Apr 13 23:20:19 RPI3 weewx[25402]: ****    File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in __str__
Apr 13 23:20:19 RPI3 weewx[25402]: ****      rc = getattr(self, mainMethName)()
Apr 13 23:20:19 RPI3 weewx[25402]: ****    File "_home_weewx_skins_Standard_index_html_tmpl.py", line 1037, in respond
Apr 13 23:20:19 RPI3 weewx[25402]: ****    File "_home_weewx_skins_Standard_index_html_tmpl.py", line 182, in __errorCatcher17
Apr 13 23:20:19 RPI3 weewx[25402]: ****    File "<string>", line 1, in <module>
Apr 13 23:20:19 RPI3 weewx[25402]: ****  TypeError: format() takes at least 2 arguments (1 given)
Apr 13 23:20:19 RPI3 weewx[25402]: cheetahgenerator: Generated 12 files for report StandardReport in 4.00 seconds
Apr 13 23:20:20 RPI3 weewx[25402]: genimages: Generated 12 images for StandardReport in 0.77 seconds
Apr 13 23:20:20 RPI3 weewx[25402]: reportengine: copied 14 files to /home/weewx/public_html
Apr 13 23:20:40 RPI3 weewx[25402]: reportengine: ftp'd 38 files in 19.90 seconds

My weewx is 3.6.2, it's not a version problem is it?
It's late here (Sembach, Germany), I hope I didn't fat finger a typo with all the editing, but I've checked and it looks clean.
Thanks ----


gjr80

unread,
Apr 13, 2020, 7:42:55 PM4/13/20
to weewx-user
Hi,

The 'problem' is that you are using WeeWX v3.6.2 but reading the Customization Guide for the current WeeWX release which is v3.9.2 - and things have changed. What label formatting options you want will determine what tag you should use, $current.leafTemp1.formatted will use the skin.conf defined format but no label, $current.leafWet1.no_label(string_format, NONE_string) will use no label but requires a user specified string format and None string in the tag.

You will find the guides for your WeeWX version on your WeeWX machine in /usr/share/doc/weewx or /home/weewx/docs depending on your install type. Unless you have special glasses for reading HTML you will need to view them in your browser. Alternatively, you can view the Formatting options section of the 3.6.2 Customization Guide here - bear in mind though that most links won't work. And or of course you could upgrade to v3.9.2 :)

Gary

Messy Potamia

unread,
Apr 13, 2020, 10:19:49 PM4/13/20
to weewx...@googlegroups.com
Aha. I began to suspect that. It's doing what I need it to for now. But will upgrade to 3.9.2 soon.
Thx.

--
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/QoUlovvIZoI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/00726158-cc77-489f-b0ae-a895fe054bea%40googlegroups.com.

Messy Potamia

unread,
Apr 15, 2020, 6:46:04 AM4/15/20
to weewx-user
Okay, upgrade to 3.9.2, (with Standard skins), went without a hitch. Made a few edits to skin.conf and the .tmpls. Yes now the format options work.
Still trying to find where all the right places are to make the changes to formats I need.
----
Going to try to add a "yesterday" tab between "current", "week", ...   if you have an abbreviated short list of steps, I'd be grateful.

Thanks,
Phil

===========================

gjr80

unread,
Apr 15, 2020, 6:54:19 AM4/15/20
to weewx-user
Which skin, Seasons or Standard?

Gary

Messy Potamia

unread,
Apr 15, 2020, 3:30:30 PM4/15/20
to weewx...@googlegroups.com
Standard. I saw it on someone's Seasons page and thought I'd like it but on my Std page here. My other system although it has Seasons will stay without it for now as it's across the ocean.

PH

On Wed, Apr 15, 2020, 12:54 gjr80 <gjrod...@gmail.com> wrote:
Which skin, Seasons or Standard?

Gary

--
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/QoUlovvIZoI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.

gjr80

unread,
Apr 15, 2020, 4:07:44 PM4/15/20
to weewx-user
Ah, OK, I have some notes for how to make similar changes to Seasons that could serve as a simple checklist. Standard should not be too hard, in a nutshell you just need to:

1. Create a yesterday.html.tmpl. I would base this off week.html.tmpl
2. Change $week to $yesterday in yesterday.html.tmpl
3. Change a couple of heading from Week to Yesterday
4. In skin.conf add yesterday plots
5. Change yesterday.html.tmpl to use your yesterday plots
6. You might want to remove the 'This Month' panel, just remove the applicable div in its entirety (starts around line 201 in the template)
6. Add some navigation by adding a 'yesterday' button to each of the other .html.tmpl templates in the skin (look at the navbar div in the template)
7. Add yesterday.html.tmpl to skin.conf so it is generated

Maybe one or two others but they will show up once you get the basic page going. If you work through the template looking for week specific things and changing them to yesterday you should be 90% there.

Just remember backup what works.

Gary

On Thursday, 16 April 2020 05:30:30 UTC+10, Messy Potamia wrote:
Standard. I saw it on someone's Seasons page and thought I'd like it but on my Std page here. My other system although it has Seasons will stay without it for now as it's across the ocean.

PH

On Wed, Apr 15, 2020, 12:54 gjr80 <gjrod...@gmail.com> wrote:
Which skin, Seasons or Standard?

Gary

--
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/QoUlovvIZoI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx...@googlegroups.com.

Messy Potamia

unread,
Apr 15, 2020, 5:26:58 PM4/15/20
to weewx-user
Okay thanks, I'll try that.

Messy Potamia

unread,
Apr 17, 2020, 4:11:52 AM4/17/20
to weewx-user
The table data is working fine. As a header to the Yesterday page, I notice
   <h2>Yesterday's Wx Summary</h2>
         
<h2>$yesterday.dateTime</h2>
.
the tag yesterday doesn't seem to exist in .dateTime; I was expecting it to give Yesterday's date. Of course :)
Also, I'm not sure the image generator is building the images.
skin.conf excerpt:
    [[yesterday_images]]
        x_label_format
= %d
        bottom_label_format
= %x %H:%M
        time_length
= 97200    # == 27 hours
       
       
[[[yesterdaybarometer]]]
           
[[[[barometer]]]]
       
       
[[[yesterdaytempdew]]]
           
[[[[outTemp]]]]
           
[[[[dewpoint]]]]
       
yesterday.html.tmpl excerpt:
        <div class="header">
         
<h3>Yesterday Statistics and Plots</h3>
       
</div>
       
<div id="plots">
         
<img src="yesterdaytempdew.png" alt="temperatures" />
         
<img src="yesterdayrain.png" alt="rain" />
         
<img src="yesterdaywind.png" alt="wind" />
         
<img src="yesterdaybarometer.png" alt="barometer"/>
         
<img src="yesterdaywinddir.png" alt="Hi Wind" />
         
<img src="yesterdayinside.png" alt="Inside" />
         
<img src="yesterdayDnldSpd.png" alt="Download" />
          #if $week.extraTemp1.has_data
         
<img src="weekpond.png" alt="Pond Temperatures" />
          #end if
       
</div>

Hope I'm not expecting too much. /var/log/weewx doesn't show any complaints (default debug)

Phil

Messy Potamia

unread,
Apr 17, 2020, 10:06:18 AM4/17/20
to weewx-user
--- Moving this issue to a new topic, current.tag versus yesterday.tag ---
Reply all
Reply to author
Forward
0 new messages