weatherstorm / Sofaskin-CW9009

Sofaskin-CW9009 skin for Weewx is a modified version of the Sofaskin developed by Sven at https://neoground.com/portfolio/neowx/. He no longer supports the original skin. Please see the readme for dependency requirements to use this skin.
http://www.centuryfarmweather.com
MIT License
17 stars 11 forks source link

Error with template files #6

Closed cbirkenbeul closed 4 years ago

cbirkenbeul commented 6 years ago

Hi, yesterday I updated my weewx to version 3.8.0.1 and doing a pull request for your skin. I used it for month and it works fine. But now I got this error: Mar 1 23:40:19 weewx weewx[5037]: cheetahgenerator: Generate failed with exception '<type 'exceptions.UnicodeDecodeError'>' Mar 1 23:40:19 weewx weewx[5037]: cheetahgenerator: **** Ignoring template /etc/weewx/skins/Sofaskin-CW9009/RSS/weewx_rss.xml.tmpl Mar 1 23:40:19 weewx weewx[5037]: cheetahgenerator: **** Reason: 'utf8' codec can't decode byte 0xe4 in position 8: invalid continuation byte Mar 1 23:40:19 weewx weewx[5037]: **** Traceback (most recent call last): Mar 1 23:40:19 weewx weewx[5037]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 330, in generate Mar 1 23:40:19 weewx weewx[5037]: **** print >> _file, compiled_template Mar 1 23:40:19 weewx weewx[5037]: **** File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in __str__ Mar 1 23:40:19 weewx weewx[5037]: **** rc = getattr(self, mainMethName)() Mar 1 23:40:19 weewx weewx[5037]: **** File "_etc_weewx_skins_Sofaskin_CW9009_RSS_weewx_rss_xml_tmpl.py", line 104, in respond Mar 1 23:40:19 weewx weewx[5037]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 593, in filter Mar 1 23:40:19 weewx weewx[5037]: **** filtered = val.decode('utf-8').encode('ascii', 'xmlcharrefreplace') Mar 1 23:40:19 weewx weewx[5037]: **** File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode Mar 1 23:40:19 weewx weewx[5037]: **** return codecs.utf_8_decode(input, errors, True) Mar 1 23:40:19 weewx weewx[5037]: **** UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 8: invalid continuation byte

The error message repeats with some other templates. Is this an error on your templates or do u think its a general one and I should look at the weewx google groups?

Thx

weatherstorm commented 6 years ago

This is the orignal RRS template written by the weewx developers. I haven't changed anything to it. If I had to guess it might have something to do with not having all the required variables assigned in the skin.conf.

weatherstorm commented 6 years ago

I don't know why your getting that error. I have seen in the forums that some characters cause the generator fail. According the post linked below the error referenced this character: "ä". This could be your problem. Let me know.

https://groups.google.com/forum/#!topic/weewx-user/msVSFGUfe0s

Blisk commented 6 years ago

I use before this sofa skin and works ok, but tried this one and get the same error. In my old sofaskin template I don't have this folder bin and file historygenerator.py

Apr 17 19:57:23 localhost weewx[12777]: reportengine: Caught unrecoverable exception in generator weewx.cheetahgenerator.CheetahGenerator Apr 17 19:57:23 localhost weewx[12777]: No module named historygenerator Apr 17 19:57:23 localhost weewx[12777]: Traceback (most recent call last): Apr 17 19:57:23 localhost weewx[12777]: File "/usr/share/weewx/weewx/reportengine.py", line 239, in run Apr 17 19:57:23 localhost weewx[12777]: obj.start() Apr 17 19:57:23 localhost weewx[12777]: File "/usr/share/weewx/weewx/reportengine.py", line 273, in start Apr 17 19:57:23 localhost weewx[12777]: self.run() Apr 17 19:57:23 localhost weewx[12777]: File "/usr/share/weewx/weewx/cheetahgenerator.py", line 155, in run Apr 17 19:57:23 localhost weewx[12777]: self.initExtensions(gen_dict[sectionname]) Apr 17 19:57:23 localhost weewx[12777]: File "/usr/share/weewx/weewx/cheetahgenerator.py", line 197, in initExtensions Apr 17 19:57:23 localhost weewx[12777]: class = weeutil.weeutil._get_object(x) Apr 17 19:57:23 localhost weewx[12777]: File "/usr/share/weewx/weeutil/weeutil.py", line 1132, in _get_object Apr 17 19:57:23 localhost weewx[12777]: mod = import(module) Apr 17 19:57:23 localhost weewx[12777]: ImportError: No module named historygenerator Apr 17 19:57:23 localhost weewx[12777]: Generator terminated

weatherstorm commented 4 years ago

You need to have the historygenerator.py in order for the skin to work. The original sofaskin template didn't have that requirement. The new one does.