error in generated file in simple template

57 views
Skip to first unread message

sc.lep...@gmail.com

unread,
Jan 24, 2021, 3:46:47 PM1/24/21
to weewx-user
Hello

I used the simple template  from https://github.com/matthewwall/weewx-simple

My platform 
Debian10 / Python 3 /last Weewx (4.3.0) 

When I activate simple template  I ve this error  :

Jan 24 21:20:16 debian-weewx weewx-WMR200[13641] ERROR weewx.cheetahgenerator: Generate failed with exception '<class 'TypeError'>'
Jan 24 21:20:16 debian-weewx weewx-WMR200[13641] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/simple/index.html.tmpl
Jan 24 21:20:16 debian-weewx weewx-WMR200[13641] ERROR weewx.cheetahgenerator: **** Reason: '>' not supported between instances of 'str' and 'int'
Jan 24 21:20:16 debian-weewx weewx-WMR200[13641] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Jan 24 21:20:16 debian-weewx weewx-WMR200[13641] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 323, in generate
Jan 24 21:20:16 debian-weewx weewx-WMR200[13641] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Jan 24 21:20:16 debian-weewx weewx-WMR200[13641] ERROR weewx.cheetahgenerator: ****    File "cheetah__etc_weewx_skins_simple_index_html_tmpl_1611519616_295277_76818.py", line 1554, in respond
Jan 24 21:20:16 debian-weewx weewx-WMR200[13641] ERROR weewx.cheetahgenerator: ****  TypeError: '>' not supported between instances of 'str' and 'int'
Jan 24 21:20:16 debian-weewx weewx-WMR200[13641] INFO weewx.cheetahgenerator: Generated 0 files for report simple in 0.08 seconds

Can someone help me  ?

Thanks 
Stéphane

sc.lep...@gmail.com

unread,
Jan 24, 2021, 3:52:18 PM1/24/21
to weewx-user
not exactly when I activated this extension , but when cheetahgenerator ;) 

Rainer Lang

unread,
Jan 24, 2021, 3:55:41 PM1/24/21
to weewx...@googlegroups.com

Would you please share your file /etc/weewx/skins/simple/index.html.tmpl ?
The error log seems to point at an error contained in this file. Something missing or too much or at the wrong place.

Without seeing it, no further conclusion possible.

Thanks and regards

--
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 on the web visit https://groups.google.com/d/msgid/weewx-user/37b0fa01-a932-4949-9239-ebc1be534da2n%40googlegroups.com.

sc.lep...@gmail.com

unread,
Jan 24, 2021, 4:00:07 PM1/24/21
to weewx-user
OK 
I dont modify the file   (from archive)  
 i rename the file in txt file 
Stephane

index.html.tmpl.txt

John Kline

unread,
Jan 24, 2021, 4:08:10 PM1/24/21
to weewx...@googlegroups.com
It seems weewx-simple does not (yet) support Python 3.

On Jan 24, 2021, at 12:46 PM, sc.lep...@gmail.com <sc.lep...@gmail.com> wrote:

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

Rainer Lang

unread,
Jan 24, 2021, 4:29:36 PM1/24/21
to weewx...@googlegroups.com

So it appears - just tested and saw that under Python 2.7.16 the skin runs without problems. Weewx is 4.3.0

Rainer Lang

unread,
Jan 24, 2021, 4:46:05 PM1/24/21
to weewx...@googlegroups.com

I think, if you also install python2 (they can be both on the same machine)
and change in /etc/default/weewx
the WEEWX_PYTHON entry into

WEEWX_PYTHON=python2

and then restart weewx, it should work.

Once the skin has been updated and tested for Python3, you can change it back to python3 again.

gjr80

unread,
Jan 24, 2021, 5:08:51 PM1/24/21
to weewx-user
No need to make such drastic changes. True it is a python 2/python3 issue but the fix is far simpler. The clue is in the error message:

Jan 24 21:20:16 debian-weewx weewx-WMR200[13641] ERROR weewx.cheetahgenerator: **** Reason: '>' not supported between instances of 'str' and 'int'

An expression involving > in the template is using a string and an integer as operands and python3 doesn’t like the string (whereas python2 will accept a numeric string). Looking through the template there are five instances where > is used in an expression. Three of these use xxxx.raw on the left hand side of the > so they are not using a string. The remaining two are using xxxx.formatted on the left hand side of the > and xxxx.formatted does return a string. So that suggests the following lines are the source of the error:

#if $trend.windSpeed.formatted > 0
&#8679;
#elif $trend.windSpeed.formatted < 0
&#8681;

I can see no reason to use .formatted over .raw in this case so try changing the above lines in /etc/weewx/skins/simple/index.html.tmpl to:

#if $trend.windSpeed.raw > 0
&#8679;
#elif $trend.windSpeed.raw < 0
&#8681;

Save the template and see how that goes on the next report cycle, no need to restart WeeWX.

Gary

sc.lep...@gmail.com

unread,
Jan 25, 2021, 7:55:42 AM1/25/21
to weewx-user
Hello  Gary  

Its OK after changed   like you write  ;) 
Thanks a lot 
Perhaps différence in Python and Python3

Thanks @all and Have a nice day ;) 
Stephane

Reply all
Reply to author
Forward
0 new messages