Looking (briefly) through the code, it looks like Nick did not port it to
Python 2. In particular, when he opens up the language configuration file,
he did not specify an encoding, so the results will not be in Unicode.

Try changing line 87 from

language_dict = ConfigObj(language_config_path)


to

language_dict = ConfigObj(language_config_path, encoding='utf-8',
default_encoding='utf-8')


No guarantees.


On Thu, Oct 8, 2020 at 4:59 AM Dani Macías Perea <
[email protected]> wrote:

> Thanks for your answer Tom.
> Sorry, I tought ImageGeneratorTranslated was part of WeeWX. It is an skin
> from Nick Dajda (brewster76)
> https://github.com/brewster76/fuzzy-archer/blob/master/bin/user/translategenerator.py
> Using Python 2.7.13.
>
>
> El jue., 8 oct. 2020 a las 13:50, Tom Keffer (<[email protected]>)
> escribió:
>
>> Hello, Daniel.
>>
>> What version of Python are you using?
>>
>> What is 'user.translategenerator.ImageGeneratorTranslated'? It is not
>> part of WeeWX. Most likely, it is creating image labels, which are not in
>> unicode.
>>
>> -tk
>>
>> On Thu, Oct 8, 2020 at 3:56 AM [email protected] <
>> [email protected]> wrote:
>>
>>> Hello,
>>>
>>> I finally updated yesterday to version 4.1. Unfortunately I get the well
>>> known UnicodeEncodeError in imagegenerator when processing spanish
>>> characters. I have tried all the tips I have found (reinstalling the font,
>>> checking locale, etc).
>>>
>>> It is weird, because some characters are being correctly generated (í)
>>> but some others don't (ó). And finally a character cannot not be generated
>>> at all and imagegenerator fails:
>>>
>>>
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>> Caught unrecoverable exception in generator
>>> 'user.translategenerator.ImageGeneratorTranslated'
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****  'ascii' codec can't decode byte 0xc3 in position 7: ordinal
>>> not in range(128)
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****  Traceback (most recent call last):
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****    File "/usr/share/weewx/weewx/reportengine.py", line 197, in
>>> run
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****      obj.start()
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****    File "/usr/share/weewx/weewx/reportengine.py", line 280, in
>>> start
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****      self.run()
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****    File "/usr/share/weewx/weewx/imagegenerator.py", line 41, in
>>> run
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****      self.genImages(self.gen_ts)
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****    File "/usr/share/weewx/weewx/imagegenerator.py", line 263,
>>> in genImages
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****      image = plot.render()
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****    File "/usr/share/weewx/weeplot/genplot.py", line 200, in
>>> render
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****      self._renderTopBand(draw)
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****    File "/usr/share/weewx/weeplot/genplot.py", line 404, in
>>> _renderTopBand
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****      top_label = ' '.join([line.label for line in
>>> self.line_list])
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in
>>> position 7: ordinal not in range(128)
>>> Oct  8 12:52:06 TrastoRaspberry weewx[25710] ERROR weewx.reportengine:
>>>        ****  Generator terminated
>>>
>>>
>>> Can anybody give me a hint of where can be the problem?
>>>
>>> Thanks!
>>>
>>> Daniel
>>>
>>> --
>>> 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 on the web visit
>>> https://groups.google.com/d/msgid/weewx-user/67de28de-dab7-49c4-8cb6-b21ddfc43399n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-user/67de28de-dab7-49c4-8cb6-b21ddfc43399n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/iMdHE0iZnrg/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/weewx-user/CAPq0zEA__m-_vPJe_nhSECVXqB-y3e2GRj6Jf0ogrOQJf8uAsw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/weewx-user/CAPq0zEA__m-_vPJe_nhSECVXqB-y3e2GRj6Jf0ogrOQJf8uAsw%40mail.gmail.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 on the web visit
> https://groups.google.com/d/msgid/weewx-user/CANpZLBAV6dsLQC99c7bAxf%2BCZGciwhGWMekZK7cSn1Gy_ubaAQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/weewx-user/CANpZLBAV6dsLQC99c7bAxf%2BCZGciwhGWMekZK7cSn1Gy_ubaAQ%40mail.gmail.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 on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEABaYONsToEibP0B1M8P_c%3DsWNUGWBcyj6z4f20BgpOzQ%40mail.gmail.com.

Reply via email to