It's the 22nd byte in the sequence of the file, which is not necessarily 
the 22nd character, because utf-8 encoded characters may be more than one 
byte. To be sure, you need a HEX-editor.
areax99 schrieb am Freitag, 29. November 2024 um 08:55:58 UTC+1:

> the editor i am using is Studio Visual Code, while how do i identify byte 
> 22 in skin.conf file? is it the position or the line in editor?
>
> Il giorno giovedì 28 novembre 2024 alle 20:37:23 UTC+1 Tom Keffer ha 
> scritto:
>
>> Can't be positive, but the odds are that it's in the skin configuration 
>> file skin.conf for the Belchertown skin. It's happening when setting up the 
>> search list, which is part of the preprocessing, rather than the processing 
>> of the templates themselves. If it was in a template, the error message 
>> should have mentioned it.
>>
>> The file is encoded in UTF-8. As ConfigObj was processing it, it found a 
>> byte with value zero in byte 22, which is not what it was expecting.
>>
>> How did it get there? The most common reason is that it was introduced by 
>> an editor that doesn't know how to handle UTF-8.
>>
>> That leads to:
>> 1. What editor are you using?
>> 2. What's in byte 22 of skin.conf? 
>>
>> On Thu, Nov 28, 2024 at 9:05 AM areax99 <[email protected]> wrote:
>>
>>> nov 28 17:55:15 raspberrypi4 weewxd[14480]: INFO weewx.manager: Added 
>>> record 2024-11-28 17:55:00 CET (1732812900) to database 'weewx.sdb'
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: INFO weewx.manager: Added 
>>> record 2024-11-28 17:55:00 CET (1732812900) to daily summary in 'weewx.sdb'
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: INFO weewx.restx: MQTT: 
>>> Published record 2024-11-28 17:55:00 CET (1732812900)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: DEBUG weewx.reportengine: 
>>> Running reports for latest time in the database.
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: DEBUG weewx.reportengine: 
>>> Report 'SeasonsReport' not enabled. Skipping.
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: DEBUG weewx.reportengine: 
>>> Report 'SmartphoneReport' not enabled. Skipping.
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: DEBUG weewx.reportengine: 
>>> Report 'MobileReport' not enabled. Skipping.
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: DEBUG weewx.reportengine: 
>>> Report 'StandardReport' not enabled. Skipping.
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: DEBUG weewx.reportengine: 
>>> Running report 'Belchertown'
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: DEBUG weewx.reportengine: 
>>> Found configuration file /etc/weewx/skins/Belchertown/skin.conf for report 
>>> 'Belchertown'
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: DEBUG weewx.reportengine: 
>>> Unable to set locale 'it': unsupported locale setting. Using default.
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: DEBUG weewx.reportengine: 
>>> Running generators for report 'Belchertown' in directory 
>>> '/etc/weewx/skins/Belchertown' with locale 'it_IT@euro'
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: DEBUG 
>>> weewx.cheetahgenerator: Using search list ['user.belchertown.getData', 
>>> 'user.tablegenerator.TableGenerator', 'weewx.cheetahgenerator.Almanac', 
>>> 'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.DisplayOptions', 
>>> 'weewx.cheetahgenerator.Extras', 'weewx.cheetahgenerator.Gettext', 
>>> 'weewx.cheetahgenerator.JSONHelpers', 'weewx.cheetahgenerator.PlotInfo', 
>>> 'weewx.cheetahgenerator.SkinInfo', 'weewx.cheetahgenerator.Station', 
>>> 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo']
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: INFO user.belchertown: 
>>> version 1.3.1
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: DEBUG weewx.manager: Daily 
>>> summary version is 4.0
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine: 
>>> Caught unrecoverable exception in generator 
>>> 'weewx.cheetahgenerator.CheetahGenerator'
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****  'utf-8' codec can't decode byte 0xe0 in position 22: invalid 
>>> continuation byte
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****  Traceback (most recent call last):
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/usr/share/weewx/weewx/reportengine.py", line 248, in 
>>> run
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      obj.start()
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/usr/share/weewx/weewx/reportengine.py", line 465, in 
>>> start
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      self.run()
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 166, 
>>> in run
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      ngen = self.generate(gen_dict[section_name], section_name, 
>>> self.gen_ts)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****             
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 226, 
>>> in generate
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      ngen += self.generate(section[subsection], subsection, 
>>> gen_ts)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****             
>>>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 226, 
>>> in generate
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      ngen += self.generate(section[subsection], subsection, 
>>> gen_ts)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****             
>>>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 309, 
>>> in generate
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      searchList = self._getSearchList(encoding, timespan,
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 401, 
>>> in _getSearchList
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      search_list += obj.get_extension_list(timespan, db_lookup)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/etc/weewx/bin/user/belchertown.py", line 409, in 
>>> get_extension_list
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      chart_dict = configobj.ConfigObj(chart_config_path, 
>>> file_error=True)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****                   
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/usr/lib/python3/dist-packages/configobj/__init__.py", 
>>> line 1229, in __init__
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      self._load(infile, configspec)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/usr/lib/python3/dist-packages/configobj/__init__.py", 
>>> line 1287, in _load
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      content = self._handle_bom(content)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****                ^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/usr/lib/python3/dist-packages/configobj/__init__.py", 
>>> line 1485, in _handle_bom
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      return self._decode(infile, 'utf-8')
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****    File "/usr/lib/python3/dist-packages/configobj/__init__.py", 
>>> line 1517, in _decode
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****      infile[i] = line.decode(encoding)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****                  ^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in 
>>> position 22: invalid continuation byte
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: ERROR weewx.reportengine:   
>>>       ****  Generator terminated
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: Traceback (most recent call 
>>> last):
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/usr/share/weewx/weewx/reportengine.py", line 248, in run
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     obj.start()
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/usr/share/weewx/weewx/reportengine.py", line 465, in start
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     self.run()
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/usr/share/weewx/weewx/cheetahgenerator.py", line 166, in run
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     ngen = 
>>> self.generate(gen_dict[section_name], section_name, self.gen_ts)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:           
>>>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/usr/share/weewx/weewx/cheetahgenerator.py", line 226, in generate
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     ngen += 
>>> self.generate(section[subsection], subsection, gen_ts)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:             
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/usr/share/weewx/weewx/cheetahgenerator.py", line 226, in generate
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     ngen += 
>>> self.generate(section[subsection], subsection, gen_ts)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:             
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/usr/share/weewx/weewx/cheetahgenerator.py", line 309, in generate
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     searchList = 
>>> self._getSearchList(encoding, timespan,
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:                 
>>>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/usr/share/weewx/weewx/cheetahgenerator.py", line 401, in _getSearchList
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     search_list += 
>>> obj.get_extension_list(timespan, db_lookup)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:                   
>>>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/etc/weewx/bin/user/belchertown.py", line 409, in get_extension_list
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     chart_dict = 
>>> configobj.ConfigObj(chart_config_path, file_error=True)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:                 
>>>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/usr/lib/python3/dist-packages/configobj/__init__.py", line 1229, in 
>>> __init__
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     self._load(infile, 
>>> configspec)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/usr/lib/python3/dist-packages/configobj/__init__.py", line 1287, in _load
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     content = 
>>> self._handle_bom(content)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:               
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/usr/lib/python3/dist-packages/configobj/__init__.py", line 1485, in 
>>> _handle_bom
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     return 
>>> self._decode(infile, 'utf-8')
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:           
>>>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:   File 
>>> "/usr/lib/python3/dist-packages/configobj/__init__.py", line 1517, in 
>>> _decode
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:     infile[i] = 
>>> line.decode(encoding)
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]:                 
>>> ^^^^^^^^^^^^^^^^^^^^^
>>> nov 28 17:55:16 raspberrypi4 weewxd[14480]: UnicodeDecodeError: 'utf-8' 
>>> codec can't decode byte 0xe0 in position 22: invalid continuation byte
>>>
>>> Help! I'm going crazy! I installed weewx with simulator and Belchertown 
>>> skin. It's not the first time I install it, I installed several weather 
>>> stations with weewx. Now I'm getting these errors, but I can't figure out 
>>> where they come from, probably from weewx.conf or skin.conf. I checked the 
>>> two files but I couldn't figure out why...
>>>
>>> -- 
>>> 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/495f1a16-26d2-4853-bf65-cf11c875bddcn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/weewx-user/495f1a16-26d2-4853-bf65-cf11c875bddcn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
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/de203f4a-071f-43a2-92dd-a7f150526688n%40googlegroups.com.

Reply via email to